Stape
Search
Try for free

How to use pre-built GTM container templates for PrestaShop

Published
Oct 18, 2024

Pre-built GTM container templates for PrestaShop offer a robust solution that streamlines the server-side tracking configuration process. These templates speed up the setup of server-side tracking for Meta, GA4, and Google Ads.

In this article, we are going to guide you through the configuration process to complete the server-side tracking setup for the PrestaShop website.

Before starting

To set up the pre-built template, make sure you have:

Step 1. Download templates from GitHub

1.1 Download GTM Templates for Prestashop from GitHub. Click on “Code” → “Download ZIP”.

Download Template from GitHub

1.2 Unzip the file you downloaded. We will use the first two highlighted templates, which include Meta, GA4, and Google Ads setup.

Unzip folder

Step 2. Import the templates into GTM

2.1 To import the templates, go to Admin → Import Container.

Please note you should import the templates in both - web and server GTM containers. The process is the same for both containers.

Import container in GTM

2.2 Select the template file from the unzipped folder (ensure you upload the correct file that matches the container type - web or server).

Select the workspace for this import - new or existing.

Select Overwrite or Merge.

The "Overwrite" option should only be used with a new or empty container. For this demo, we are using the Merge option with the "Rename conflicting tags, triggers, and variables" setting enabled. This ensures that GTM will simply rename the tags without altering existing entities in your container if any conflicts arise.

Click “Add to workspace”.

Import Container Settings

Step 3. Configure the setup

3.1 Templates come fully prepared, with configured triggers, payloads, and event names. You only need to enter your specific destinations, IDs, API keys, and other details. For your convenience, see the “Folder” section of web and server GTM containers, here, you can find the folders that start with “[Stape]”; they store all the pre-built tags and variables.

Web

Folders in web GTM container

Server

Folders in server GTM container

All the variables are already referenced in tags that use them; you only need to change the values.

Meta API token template

Here is the example with added value for the Meta API token variable:

Meta API token example

To customize the tags and variables for Meta, GA4, and Google Ads you will need the following data:

a. For Meta settings, you will need Pixel ID and API token.

You can find the Pixel ID and API token in Pixel Settings:

Dataset ID
Generate Access Token

b. For Google Analytics 4 settings, find the GA4 Measurement ID by going to Admin → Data collection and modification → Data Streams.

GA4 Measurement ID

c. Google Ads conversion ID and conversion label you can find when creating/editing a conversion goal in Google Ads.

  • Choose “Use Google Tag Manager”
Use GTM in Google Ads
  • Copy ID and label
Conversion ID and Label

Save changes.

3.2 If your GTM container is new, add a preview URL in your server container by going to Admin → Container Settings. If the container is not new, skip this step.

Add URL in container

3.3 Test and publish the setup. The test process is the same as when making changes in the GTM container. Run Google Tag Manager preview, trigger events on the website, and see them in GTM.

Step 4. Improve tracking with Stape features

Having completed the configuration, you may want to improve tracking accuracy with the help of Stape power-ups and features:

This power-up ensures that your marketing cookies remain functional, even if they get deleted for any reason.

This feature enhances the resilience of Google Tag Manager and Google Analytics 4 scripts against ad blockers and ITPs by adjusting the loading paths of gtag.js and gtm.js.

  • Custom Domain

Using a custom domain allows you to extend cookie lifespan by setting first-party cookies instead of third-party ones.

See the detailed instructions on how to add a custom domain to the Google Tag Manager server container in our blog post.

Conclusion

Pre-built container templates for PrestaShop provide a quick and convenient way to implement your tracking. The templates will serve those who need a solid foundation for the future setup. Customizing pre-built templates and testing the setups are the last steps in configuring server-side tracking for your PrestaShop website.

Host your GTM server at Staperight now!