nprapps / elections24-primaries

2024 primary/caucus election results
https://apps.npr.org/primary-election-results-2024/
Other
5 stars 1 forks source link

Analytics not being collected from embeds #150

Closed alykat closed 8 months ago

alykat commented 8 months ago

I'm only seeing analytics in GA for embedded state pages, not standalone embeds.

Standalone embeds (including the Super Tuesday embed) get a reference to Chartbeat (which ultimately isn't used b/c it's an embed): https://github.com/nprapps/elections24-primaries/blob/main/src/embeds/index.html#L23 https://github.com/nprapps/elections24-primaries/blob/main/src/embeds/super-tuesday.html#L23

But there's no reference to analytics.js or tracking.js in the embed JS, as there is in the regular page JS. https://github.com/nprapps/elections24-primaries/blob/main/src/js/embeds/custom.js https://github.com/nprapps/elections24-primaries/blob/main/src/js/embeds/super-tuesday.js https://github.com/nprapps/elections24-primaries/blob/main/src/js/statePage.js#L1-L4