Outlinks and GA4

New Member
2 0 0


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!

Reply 1 (1)
1020 85 112

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>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'YOUR-GA4-TRACKING-ID');


  1. Make a note of the "YOUR-GA4-TRACKING-ID" value, as you'll need it for the next step.

  2. 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'


Need a Shopify developer? Chat on WhatsApp: +923246370042
Hire us at noumanmasood64@gmail.com
For Shopify Design Changes | Shopify Custom Coding | Custom Modifications