Skip to content

Commit

Permalink
Setting up Google Analytics
Browse files Browse the repository at this point in the history
Followed these instructions academicpages#265
  • Loading branch information
mijtsma committed Sep 1, 2023
1 parent 05cffb0 commit 1264fe5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ social:

# Analytics
analytics:
provider : "google-universal" # false (default), "google", "google-universal", "custom"
provider : "custom" #"google-universal" # false (default), "google", "google-universal", "custom"
google:
tracking_id :

Expand Down
8 changes: 8 additions & 0 deletions _includes/analytics-providers/custom.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
<!-- start custom analytics snippet -->
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-5Q84E1GXB1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'G-5Q84E1GXB1');
</script>
<!-- end custom analytics snippet -->
2 changes: 1 addition & 1 deletion _includes/scripts.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script src="{{ base_path }}/assets/js/main.min.js"></script>

{% include analytics.html %}
<!-- {% include analytics.html %} -->
{% include /comments-providers/scripts.html %}
1 change: 1 addition & 0 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<!doctype html>
<html lang="{{ site.locale | slice: 0,2 }}" class="no-js">
<head>
{% include analytics.html %}
{% include head.html %}
{% include head/custom.html %}
</head>
Expand Down

0 comments on commit 1264fe5

Please sign in to comment.