Skip to content

Commit

Permalink
update legacy UA analytics to GA4 (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xdevalias authored Jul 1, 2024
1 parent 58ea83d commit b0ad9f1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
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

0 comments on commit b0ad9f1

Please sign in to comment.