logo

Shopify

The Shopify implementation works by editing the native Shopify Google Analytics configuration to send data to the SegmentStream server which then forwards the data to your Google Analytics 4 property.
If you are using Shopify but have connected Google Analytics 4 through GTM, please follow this guide - Basic GTM.

SegmentStream admin panel setup

  1. Inside the admin panel navigate to Settings > Events Tracking.
  1. Click on the field containing the Server Container URL to copy its value to your clipboard and click SAVE.
Image without caption

Edit your Shopify configuration

  1. From your Shopify admin, got to Online store > Preferences.
  1. Click Google from the left side menu.
  1. Copy the ID of the Google Analytics tag, you'll need it in later steps.
    1. Image without caption
  1. From your Shopify admin, go to Online Store > Themes.
  1. Click ... > Edit code.
  1. Open the theme.liquid file.
  1. Enter the following code in the head of the file, replacing G-XXXXXXXXXX with the ID copied from step 3, and ENDPOINT with the value of the Server Container URL field found in your SegmentStream project.
    1. xml
      <!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script> <script> window.dataLayer = window.dataLayer || []; functiongtag(){dataLayer.push(arguments);} gtag('js',new Date()); gtag('config', 'G-XXXXXXXXXX', { transport_url: 'ENDPOINT', send_page_view: false }); </script>
  1. The code should look like this.
    1. Image without caption
  1. Click Save.