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

Google Analytics v4 (Tag Manager) #69

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
14 changes: 8 additions & 6 deletions _includes/cookie-consent.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,16 @@
createCookie(name,"",-1);
}

function load_google_analytics() {
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', 'UA-44071631-2', 'auto');
ga('send', 'pageview');
function load_google_analytics_tag_manager() {
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'G-2YX2GXC6Q8');
}

if(readCookie('cookie-notice-dismissed')=='accepted') {
load_google_analytics()
load_google_analytics_tag_manager()
} else if(readCookie('cookie-notice-dismissed')=='rejected') {
// do nothing
} else {
Expand All @@ -48,7 +50,7 @@
document.getElementById('cookie-notice-accept').addEventListener("click",function() {
createCookie('cookie-notice-dismissed','accepted',31);
document.getElementById('cookie-notice').style.display = 'none';
load_google_analytics()
load_google_analytics_tag_manager()
});

document.getElementById('cookie-notice-reject').addEventListener("click",function() {
Expand Down
12 changes: 8 additions & 4 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">

<!-- Google tag (gtag.js) (old Google analytics) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-2YX2GXC6Q8"></script>
<!-- comment out below and uncomment "include cookie-consent.html" below -->
<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', 'UA-44071631-2', 'auto');
ga('send', 'pageview');
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'G-2YX2GXC6Q8');
</script>
<script async src='https://www.google-analytics.com/analytics.js'></script>

{% if page.url == "/" %}<title>{{ site.description }}</title>{% else %}<title>{{ page.title | default: site.title }}</title>{% endif %}

Expand Down
11 changes: 7 additions & 4 deletions tools/recursion-visualization/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@
<link rel="manifest" href="/icon/site.webmanifest">
<link rel="mask-icon" href="/icon/safari-pinned-tab.svg" color="#5bbad5"><link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap">

<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-2YX2GXC6Q8"></script>
<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', 'UA-44071631-2', 'auto');
ga('send', 'pageview');
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'G-2YX2GXC6Q8');
</script>
<script async src='https://www.google-analytics.com/analytics.js'></script>

<script data-ad-client="ca-pub-2026571203025921" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
</head>
Expand Down