Skip to content

Add google tag manager tracking#84

Merged
jacobtomlinson merged 2 commits intodask:mainfrom
scharlottej13:gtm
Jun 6, 2023
Merged

Add google tag manager tracking#84
jacobtomlinson merged 2 commits intodask:mainfrom
scharlottej13:gtm

Conversation

@scharlottej13
Copy link
Contributor

Adding GTM to the dask theme since read the docs does not support google tag manager (you can only add GA-4 analytics IDs). If we confirm this is working, then we can remove the analytics ID from RTD.

cc @emilyvalentine @jacobtomlinson

Copy link
Member

@jacobtomlinson jacobtomlinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @scharlottej13, a few questions.

@@ -1,5 +1,33 @@
{%- set favicon_url = favicon_url or ('_static/' + ('images/favicon.svg')) %} {%
extends "sphinx_book_theme/layout.html" %} {%- block content %}
extends "sphinx_book_theme/layout.html" %} {% block extrahead %}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to add this to the footer instead of the head? Putting it in the head will block the page from loading until the script is done.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, I can move it down! I was following the GTM instructions, but at least one person on the internet claims moving it down won't affect analytics

j.async = true;
j.src = "https://www.googletagmanager.com/gtm.js?id=" + i + dl;
f.parentNode.insertBefore(j, f);
})(window, document, "script", "dataLayer", "GTM-P4GQM59");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess GTM-P4GQM59 is our ID? Do we want to make this overridable via the Sphinx theme config? Do you see any reason why we might want to change this on a per-project basis in the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm good question. I don't see a reason to change this per-project... but it might help for visibility to have it defined in https://github.com/dask/dask-sphinx-theme/blob/main/dask_sphinx_theme/theme.conf

Copy link
Member

@jacobtomlinson jacobtomlinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great thanks @scharlottej13

@jacobtomlinson jacobtomlinson merged commit 30f977d into dask:main Jun 6, 2023
@jacobtomlinson
Copy link
Member

I've tagged 3.0.5 so future builds of docs pages should pick up this and we should start seeing metrics rolling in as releases happen.

@scharlottej13 scharlottej13 deleted the gtm branch June 6, 2023 15:35
@scharlottej13
Copy link
Contributor Author

Sounds good, thanks @jacobtomlinson!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants