Skip to content

Commit 4de0396

Browse files
committed
build: UA -> GA4
1 parent 15b28b5 commit 4de0396

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

podspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ static_dirs:
1919
# Website meta
2020
meta:
2121
favicon_path: /source/images/favicon.ico
22-
google_analytics_id: UA-18658848-9
22+
google_analytics_id: G-TB9BJHX4KF
2323

2424
# Preprocessors
2525
preprocessors:

views/base.html

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,13 @@
2121

2222
{# google analytics #}
2323
{% if podspec.meta.google_analytics_id %}
24+
<script async src="https://www.googletagmanager.com/gtag/js?id={{ podspec.meta.google_analytics_id }}"></script>
2425
<script>
25-
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
26-
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
27-
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
28-
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
29-
ga('create', '{{ podspec.meta.google_analytics_id }}', 'auto');
30-
ga('require', 'eventTracker', {
31-
events: ['click', 'auxclick', 'contextmenu'],
32-
hitFilter: function(model, element, event){
33-
model.set('eventAction', event.type, true)
34-
}
35-
});
36-
ga('send', 'pageview');
26+
window.dataLayer = window.dataLayer || [];
27+
function gtag(){dataLayer.push(arguments);}
28+
gtag('js', new Date());
29+
30+
gtag('config', '{{ podspec.meta.google_analytics_id }}');
3731
</script>
3832
{% endif %}
3933
{# styles and links #}

0 commit comments

Comments
 (0)