-
Notifications
You must be signed in to change notification settings - Fork 661
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
Support new-style Google Analytics IDs #1300
Comments
Hi @choldgraf-- I'm looking to add the new style of Google Analytics ID into a Jupyter Book. Is there an update on the status of this issue? |
I believe this should now "just work" assuming that you are using the latest pydata sphinx theme, I'll close this issue but feel free to re-open if it still doesn't work |
Ah nevermind, we need to update the pydata theme in the sphinx book theme and make a new release. Will do that now. |
ok a new release is out, so new GA style badges should be possible! Try upgrading with
|
Thank you for the update! After testing this out, the analytics still are not viewable with the new GA badge. The latest release I see is v0.11.2, which is from 7 days ago. Is this the release with new GA style badges? CC: @choldgraf |
Hi @choldgraf, I'm still seeing no data sent to analytics through the g-tag. The code does appear in the deployed and compiled html though. |
huh - so the correct javascript is in the page, but GA doesn't get the right data? |
Hmmmm that is interesting indeed. Perhaps it's causing the issues that we're experiencing. Maybe you could try manually removing one of the duplicated scripts on a page, and seeing if that fixes the issue? Then we can find a fix for this |
@choldgraf I'll give this a go and report back tomorrow. |
@choldgraf. The issue seems to be that it is loading twice, and the fact that the gtag snippet is in the footer, where it should be in the header. I manually moved the tag to the header and it worked fine. I've looked for the code that deals with this but I can't find it, happy to fix it if you can point me in the right direction though. |
hmmm - so Jupyter Book in general should be getting its Google Analytics behavior from the PyData Sphinx Theme (https://pydata-sphinx-theme.readthedocs.io/en/latest/user_guide/configuring.html#google-analytics) which is a parent theme of the Sphinx Book Theme, the theme that Jupyter Book uses. I'm not sure why it would be duplicated though! |
So after a bit more digging, the code doesn't appear to be duplicated, so not sure what's going on in the sources list. There are two differences between the code that PyData Sphinx is inserting and the code that I tested which works:
One or both of these are probably what's causing the problem |
Hmm - here is the GA script insertion code in the theme: and here is where it's inserted: |
I've made a PR with the changes |
@choldgraf should this be reopened temporarily? Seems that once pydata sphinx theme 0.6.4 is released it will be fixed |
yep good point! |
For the G4 tag, I am being requested to
Updating the I am trying to use _template to fix this as suggested here. I will let you know. executablebooks/meta#726 (comment) |
Pretty sure this resolved it:
In _config.yml
|
Nevermind. My suggestion didn't work.... seems like i might have used the wrong code |
Hi @mmann1123, I believe I sorted this issue out a few years ago. Are you still having issues, if so, I can dig out the solution? Thanks, |
@jackminchin You are right. I had just inserted the wrong g-code. Seems to be working now. Thanks for your work on this project! Its been a real life-saver. |
@mmann1123, @jackminchin, this works for me! I couldn't find any other way around it. Should this issue be reopened? In the meantime, this could be added to the documentation. |
Thanks. Adding that to the docs would be helpful |
Summary
There's a new kind of Google Analytics ID, and our current base theme doesn't use the right JavaScript for it. We depend on the upstream PyData theme for this.
To Do
The text was updated successfully, but these errors were encountered: