Skip to content

Commit 36277b9

Browse files
committed
Use Google Tag Manager for integration with Google Analytics and honour DNT.
Per discussion and review on pgsql-www.
1 parent 66f96bb commit 36277b9

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

media/js/main.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/*
2-
* Initialize google analytics
2+
* Initialize google tag manager for analytics integration
33
*/
4-
var _gaq = _gaq || [];
5-
_gaq.push(['_setAccount', 'UA-1345454-1']);
6-
_gaq.push(['_trackPageview']);
7-
(function() {
8-
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
9-
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
10-
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
11-
})();
4+
var DNT = navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack || window.msDoNotTrack;
5+
if ((DNT != "1") && (DNT != "yes")) {
6+
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
7+
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
8+
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
9+
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
10+
})(window,document,'script','dataLayer','GTM-WC97NKC');
11+
}
1212

1313
/*
1414
* Fix scrolling of anchor links

0 commit comments

Comments
 (0)