Skip to content

Commit

Permalink
Added google analytics following the instruction of academicpages#265
Browse files Browse the repository at this point in the history
  • Loading branch information
boyiwei committed Feb 10, 2024
1 parent b58e3dd commit 1df434b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 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" # 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-82ZZXN2R3V"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'G-82ZZXN2R3V');
</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
2 changes: 1 addition & 1 deletion _pages/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ I am broadly interested in AI alignment and other AI safety-related topics. Feel
[![Hits](https://hits.sh/boyiwei.com.svg?label=visitors)](https://hits.sh/boyiwei.com/)


<a href='https://clustrmaps.com/site/1byh7' title='Visit tracker'><img src='//clustrmaps.com/map_v2.png?cl=ffffff&w=300&t=tt&d=BRxMw116OpLs6k-l68T-dUZhr9qyQwQX5v1e68CxQjI'/></a>
<!-- <a href='https://clustrmaps.com/site/1byh7' title='Visit tracker'><img src='//clustrmaps.com/map_v2.png?cl=ffffff&w=300&t=tt&d=BRxMw116OpLs6k-l68T-dUZhr9qyQwQX5v1e68CxQjI'/></a> -->



Expand Down

0 comments on commit 1df434b

Please sign in to comment.