Select to view content in your preferred language

Tracking troubles using Google Analytics 4 on StoryMaps

671
1
02-29-2024 12:23 PM
Status: Open
OliviaAHobson
Emerging Contributor
My company is running into a problem using Google Analytics 4 tracking in StoryMaps. After noticing some discrepancies between AGOL's item usage tracking and GA4's tracking, we're worried that we're losing tracking data for viewers that aren't staying on the StoryMap for very long because GA4 is literally the last line of the document, which means that it won't load for quite some time, especially on large StoryMaps. Esri is also only partially installing the GA4 script. They have the link included (the first line of the screenshot), but do not have the <script> tag at all -- which we believe is interfering with tracking when embedded because it can't turn on cross-domain tracking.
 
 
image.png

Another more particular problem we're facing with GA4 tracking on StoryMaps is when they're embedded on other websites then GA4 does not log any page views or events. We have enabled cross domain tracking on the GA4 side, but still do not see page views from embeds. This is likely because the GA4 code is only including the link and not the <script> tag with the `config` call.
 
Example GA4 install code:
<!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-123456789"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); <!-- cross domain linking can go here -->
gtag('config', 'G-123456789'); </script>
 
We're curious if Esri could adjust the GA4 code higher up in the document to lead to more accurate tracking on StoryMaps with short viewerships, and if there are any solutions to our problem with losing valuable analytics information about user engagement when StoryMaps are embedded on other websites.
Tags (1)
1 Comment
ThePreatorian

@OliviaAHobson  We are sorry to hear you are running into issues with the Google Analytics feature.

The team is investigating possible solutions to this, and will update this thread if and when we find a solution.