question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Google Analytics Seems To Be Broken For A Certain Use Case

See original GitHub issue

Describe the bug

Upon building and hosting a Juypter Book via GitHub Pages with a custom domain, Google Analytics does not seem to register the MEASUREMENT ID when entered into _config.yml.

To Reproduce

Steps to reproduce the behavior:

  • Build and host a Jupyter Book via GitHub Pages
  • Use a custom domain via CNAME file within the repo root
  • Create Google Analytics Property and subsequent Web Stream obtaining a MEASUREMENT ID.
  • Insert MEASUREMENT ID as a string into _config.yml as such:
html:
    google_analytics_id: '<your-id-here>'

Expected behavior

Google Analytics properly syncs with the site and produces traffic analytics.

Environment

  • Python 3.9.1:
  • Output of jupyter-book --version:
    • Jupyter Book: 0.9.1
    • MyST-NB: 0.10.1
    • Sphinx Book Theme: 0.0.39
    • MyST-Parser: 0.12.10
    • Jupyter-Cache: 0.4.1
    • NbClient: 0.5.1
  • MacOS version: 11.0.1

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
ofajardocommented, Mar 2, 2021

I’m having the same issue. What I think is happening is that there is a new version of google analytics. The code in jupyterbook is for the old version and probably needs the old “Tracking” ID to work (UA-XXXX), while the code that @wyattowalsh is reporting is for the new version that requires an “Universal” ID of style G-XXXX. When creating a new project Google Analytics now gives you the new Universal ID, while for now you can still obtain an old tracking ID, I guess that will be gone at some point. Probably it would be good if jupyterbook would update the javascript snippet to the new version (the one that is suggested in this same thread)

1reaction
choldgrafcommented, Apr 14, 2021

Hey all - I figured out that this is going to require a change in the pydata sphinx theme, where we inherit this functionality. I’ve opened up this issue to track that upstream change: https://github.com/executablebooks/jupyter-book/issues/1300

gonna close this one since the other will be a bit cleaner to read. Thanks everybody for helping figure out what was going on!

@jcheong0428 feel free to open a different issue about the google analytics code not showing up at all - that doesn’t seem related to this one specifically

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why Your Google Analytics Data is Inaccurate and How To Fix It
Here we break down 4 common scenarios where Google Analytics is giving you inaccurate numbers and how to make the quick fixes.
Read more >
29 Common Google Analytics Data Errors And How To Fix Them
Google Analytics data not showing all traffic or no view data? Here's why your data is wrong and how to fix the most...
Read more >
Google Analytics not working? Here are 21 ways to fix it
Google Analytics not working ? Here are 21 ways to fix it. #1 Delete and Disable the cache #2 Use Google Tag Assistant...
Read more >
Google Analytics Not Working: 20 Common Errors & How to ...
Find out why Google Analytics is not woking. We've compiled a list of most common errors in Google Analytics and their fixes.
Read more >
Why Your Google Analytics Isn't Working (and How to Fix It)
If your Google Analytics is not working as expected and your data isn't ... to locate a specific type of request using the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found