Can't seem to get Google Analytics to work with my Story

Jul 27, 2021

Wondering if anyone can assist me understand why I can't seem to get Google Analytics to work with my story. 

I think I have a pretty good handle on the process where I need to embed code in my story.html file (in the <head> section)

I've tried the following formats but have not been able to see my usage reflect on my google analytics dashboard. 

I tried using the global tag provided by Google (measurement ID altered for privacy):

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-K7G2L9ZBTV"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'G-K7G2L9ZBTV');
</script>

I've also tried:

<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', 'G-K7G2L9ZBTV', 'auto');
ga('set', 'appName', 'Google Analytics Example');
</script>
<script async src="https://www.google-analytics.com/analytics.js"></script>

as per advised here

neither seems to work. 

Although it seems like a fever dream at this point, I was able to briefly get the page visit tracking to work, but in my process of getting event tracking set up I broke things. 

Any advice would be appreciated. I can also answer any questions to help clarify the steps i've taken. 

 

3 Replies