Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update legacy UA analytics to GA4 #110

Merged
merged 1 commit into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ repository: 0xdevalias/devalias.net
# alexa: 1234
# yandex: 1234

google_analytics: UA-27970144-1
google_analytics: G-3FW5B1CS26
disqus_shortname: devalias

# Front Matter defaults (http://jekyllrb.com/docs/configuration/#front-matter-defaults)
Expand Down
2 changes: 2 additions & 0 deletions _includes/head/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
<!-- <meta name="twitter:image" content="{{ site.baseurl | chomp_slash }}{{ site.default_cover }}" /> -->
<!-- /end tags -->

{% include scripts/analytics.html %}

{% include head/styles.html %}
{% include head/fontawesome.html %}

Expand Down
17 changes: 8 additions & 9 deletions _includes/scripts/analytics.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<!-- Google Analytics Tracking code -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

ga('create', '{{ site.google_analytics }}', 'auto');
ga('send', 'pageview');
</script>
gtag('config', '{{ site.google_analytics }}');
</script>
1 change: 0 additions & 1 deletion _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
<script type="text/javascript" src="{{ site.baseurl | chomp_slash }}/assets/js/jquery.fitvids.js"></script>
<script type="text/javascript" src="{{ site.baseurl | chomp_slash }}/assets/js/index.js"></script>

{% include scripts/analytics.html %}
{% unless site.webmentions.disabled %}
{% include scripts/webmention.html %}
{% endunless %}
Expand Down