All things Shopify and commerce
Hi,
I use the outlink app on my shopify store and had Google Analytics tracking set up. I'm working on migrating over to GA4, but wasn't sure how to set up outlink click tracking for GA4? Thanks in advance!
Find the GA4 tracking code: Look for the existing GA4 tracking code in your theme.liquid file. It should look something like this:
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=YOUR-GA4-TRACKING-ID"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'YOUR-GA4-TRACKING-ID');
</script>
Make a note of the "YOUR-GA4-TRACKING-ID" value, as you'll need it for the next step.
Add the outlink click tracking code: Insert the following code snippet just before the </script>
tag in the GA4 tracking code:
gtag('event', 'click', {
'event_category': 'Outbound Link',
'event_label': 'YOUR-OUTLINK-LABEL'
});
Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024Digital marketers and app developers have tracked activity in apps and websites for yea...
By Ollie Mar 13, 2024February was an exciting month with Shopify Editions, informative webinars, and more! F...
By JasonH Mar 7, 2024