Stape
Search
Try for free

How to use pre-built GTM container templates for WooCommerce

Updated
Oct 16, 2024
Published
Jul 29, 2024

Are you looking to simplify server-side tracking setup for your WooCommerce store? This guide will help you use Stape's GTM container templates to quickly and easily set up tracking 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 Wordpress store can be found in our blog.

Step 1. Download container templates

Download GTM templates for WooCommerce on our GitHub.

Download GPT templates for WooCommerce

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:

woocommerce gtm container templates
how to add templates to container

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.

“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 container settings

Server:

server container settings

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

values for variable configuration

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

Pixel ID and API token
Pixel ID and API token

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

GA4 Measurement 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
choose “Use Google Tag Manager”
copy id and label

1.4. 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

Don’t forget to save your changes!

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

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

Host your GTM server at Staperight now!