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!
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:
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'
});