Stape
Search
Try for free

How to use pre-built GTM container templates for your Shopify store

Updated
Sep 10, 2024
Published
Jul 22, 2024

This guide will walk you through the process of implementing server-side tracking for your Shopify store using Stape's pre-built GTM container template. This template simplifies and speeds up the server-side tracking setup for Meta, GA4 and Google Ads.

Before we start, make sure you have:

More information on how to set up server-side tagging on your Shopify store can be found in our blog.

Step 1. Download container templates

1. Download templates on our GitHub.

shopify templates by stape for shopify

2. Once you unzip the downloaded file an open the folder it contains, make sure you see the following:

shopify templates by stape for shopify

For the purposes of this article we’ll be using highlighted templates which include Meta, GA4 and Google Ads setup. 

Step 2. Import container templates into your GTM

1. You should import the templates in both your web and server container on GTM (process is the same across the two). You need to go Admin → Import Container:

import templates for shopify store

2. Select your template file (make sure the template matches the container type - web/server).

3. Pick a workspace for this import (you can create a new one for this specific purpose).

4. Select Overwrite or Merge.

import templates for shopify store: overwrite or merge
“Overwrite” option should only be used in a fresh, empty container or if you are absolutely certain you want to do it. For this demo I’m using Merge, with ‘Rename conflicting tags, triggers and variables’ option selected. This way, if there are any conflicts - GTM will just rename the tags, thus not touching any of the existing entities you have in your container.

Step 3. Configure your new setup

1. Templates are fully built, so triggers, payloads, and event names are all taken care of for you. You just need to input your specific destinations, ids, API keys etc. We’ve tried to make it as comfortable as possible, so in both containers (web and server), you will find a folder called [Stape] _Settings.

Web:

web setting for shopify templates

Server:

server settings for shopify templates

All these variables are already referenced in tags that use them; you just need to give them proper values, for example:

variable configuration

1.1. Pixel ID and API token can found in your pixel settings:

Pixel ID and API token can found in your pixel settings
Pixel ID and API token can found in your pixel settings

1.2. To find GA4 Measuremend ID: go to Admin → Data collection and modification → Data Streams.

find GA4 Measuremend ID

1.3. Google Ads conversion ID and conversion label can be found when creating/editing a conversions goal in Google Ads.

  • choose “Use Google Tag Manager”
  • copy id and label
Google Ads conversion ID and conversion label
Google Ads conversion ID and conversion label

Don’t forget to save your changes!

2. Once you’ve changed all these variables and saved them, your last step (assuming this a new container) is to add a preview URL in your server container by going to Admin → Container Settings. If the container is not new, just skip this step.

add a preview URL in your server container

3. From here on you can test and publish your new setup! Yes, it’s that easy.

Step 4. Improve your tracking with cool features from Stape

Now that you have implemented and tested your setup, you might want to consider improving your tracking accuracy. For each Stape's app you can:

This power-up will help you maintain the functionality of your marketing cookies, even if they are deleted for any reason.

This feature helps make Google Tag Manager and Google Analytics 4 scripts more resistant to ad blockers and ITPs by modifying gtag.js and gtm.js loading path.

With custom domain, you can increase cookie lifetime by setting first-party cookies instead of third-party cookies. 

They can significantly impact the effectiveness and flexibility of your server-side tracking. 

Conclusion

Pre-built container templates are a fast and easy way to implement your tracking and we urge you to use them if you’re just starting or need a good skeleton for your future setup. You can and should expand on them, add custom events and tailor your setup to your specific needs. Happy Tagging!

Tagged with:gtm server

Try Stape for all things server-sideright now!