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'
});
User | RANK |
---|---|
19 | |
17 | |
17 | |
14 | |
13 |
We're excited to announce improvements to the threaded messaging experience in our communi...
By TyW May 31, 2023Thank you to everyone who participated in our AMA with Klaviyo. It was great to see so man...
By Jacqui May 30, 2023Photo by Marco Verch Sales channels on Shopify are various platforms where you can sell...
By Ollie May 25, 2023