Server-side tagging for WordPress

May 14, 2024
Oct 16, 2020
Also available in

Are you looking to try server-side tagging for your WordPress website? A server-side Google Tag Manager container is the best solution if you want to track data accurately and report it to analytics or marketing platforms.

This article will explain how to set up Google Tag Manager Server-Side Container in WordPress using GTM server-side plugin by stape.

What is server-side tagging?Copy link to this section

Server-side tagging is a new method of implementing tracking that takes place on a cloud server instead of the user's browser. It makes the website load faster and reduces the chances of data loss due to ad blockers or network errors.

With server-side tagging, all tags and scripts are managed and executed on a separate server, which sends back the necessary data to advertising or marketing instead of requiring the browser to load and execute each script individually. This approach allows for greater control over the tag management process and can help to improve website performance, increase data accuracy, and ensure compliance with data privacy regulations.

As web analytics adapt to modern restrictions and ever-evolving rules, server-side tracking methods are quickly becoming the new standard for user identification. This technology has grown exponentially in popularity over recent years as companies seek more reliable data collection tactics.

Main benefits of server-side taggingCopy link to this section

1. Increase cookie lifetime

Safari and Firefox ITPs restrict the cookie lifetime. Previously your cookie could live up to 2 years, and now its lifespan is limited to 7 days or even 24 hours. You can extend the cookie lifetime with any tracking implemented on the server environment. And for now, that is the easiest way to reach the goal. If you don’t do that, users who return to your website after 7 days (or, in some cases, 24 hours) will be considered new users. As a result, the data quality inside analytics will decrease.

2. Improved Data Accuracy

Most WordPress site owners see discrepancies between the number of transactions in analytics platforms and their CRM. It happens because of ad blockers and errors inside client browsers with 3rd party pixels. You can eliminate this problem by moving tracking to the server-side with an enabled custom loader. With the help of a custom loader, you can make tracking scripts invisible for ad blockers.  

3. Faster Page Load Speed

Heavy javascript is one of the most popular reasons for decreased site page speed. With server-side tagging, you will remove 3rd party pixels from the browser to cloud servers. Google recently released a study showing that every 0.1-second reduction in mobile website speed, on average, increases order value by nearly 10%.

If you are impressed by what Server-Side Google Tag Manager offers, you will be happy to hear that adding GTM Server Container to your WordPress website is effortless with our plugin. Furthermore, the plugin is free; though we offer several pricing plans for our services, you can check the details here.

4. Reduced risk of data privacy violations. 

By managing all tags on the server-side, marketers can ensure that user data is collected and processed in compliance with data privacy regulations, reducing the risk of data privacy violations.

GTM Server Side WordPress plugin by stapeCopy link to this section

Stape has developed a unique GTM Server Side WordPress plugin to make it easier than ever for website owners to utilize the power of server-side tagging. With this specialized plugin, users can take advantage of robust features that previously required extensive technical knowledge and programming chops, enabling them to enhance their digital marketing efforts without breaking a sweat. Let me describe the possibilities of the GTM Server Side plugin for WordPress

1. Inserts Google Tag Manager script on the websiteCopy link to this section

GTM server-side plugin can either insert GTM script on all website pages or work with other WP plugins that insert GTM script on the website. The second option will be active only when the stape plugin detects the GTM snippet added via another plugin. With the second option, the stape plugin won’t add GTM script on all website pages but will add all the configured features. 

WEB Google Tag Manager ID - ensure to add WEB Google Tag Manager ID. If you add server GTM ID, it will cause 403 errors

GTM server container URL - this is a domain you use for your server GTM container. We recommend setting up a custom domain within your website domain since it will allow setting up 1st party cookies.

Stape container identifier - this parameter adds a Custom loader to your GTM script. Follow these steps to find the stape container identifier

Cookie keeper - this is a power-up feature that you can activate ONLY if you have a container at Stape. With it you can easily continue using the full cookie duration.

gtm server side for wordpress

2. Sends dataLayer to web GTM containerCopy link to this section

This option allows sending e-commerce data and user data to the data layer. Note that it can work only with woocommerce shops. 

Data Layer events: 

- Login, 

- SignUp 

- ViewItem

- AddToCart

- BeginCheckout

- Purchase

User data: 

- Name

- Surname

- Email

- Etc.

gtm server side for wordpress

3. Sends webhooksCopy link to this section

GTM Server Side plugin can send Purchase and Refund webhook to the server GTM container. To enable webhooks, add the server GTM container URL and select the event you want to send to sGTM. Need help determining what webhooks are, check this article

How to set up GTM server side plugin by stapeCopy link to this section

1. Log into your WordPress Admin, and go to the plugins. Then, click “Add New,” type “GTM Server-Side,” choose this plugin, and click install now. Once established, click Activate.   

gtm server side for wordpress by stape

2. Create a Google Tag Manager Server container if you don’t have one. Go to and choose the account where you want to create a container. Then, click Admin.

Admin in tagmanager

3. Under the container column, click +.

container column

4. Type container name, choose Server and click create. 

create server container

5. On the install pop-up, choose “Manually provision tagging server,” copy your container config and paste it into any text editor. We will need it for the next steps.

install google tag manager

6. Create an account within our service here

7. Once you receive the confirmation email and set your password, you need to create a container. Enter your container name and paste the container config that you copied from your Google Tag Manager Server Container. Then, click Create Container.

container configuration

8. Once you click create, you will see the status of your container, container config, and plan name. It takes around 5 minutes to deploy a server container. Please reload the page to update the status. If the setup was done correctly, you should see the status “Running.”

container status running

If you see “Error,” please check if you’ve copied and pasted the correct container configuration. 

If the error repeats, please contact support.

9. Set up a tagging URL. Inside your Google Tag Manager, click admin, select container settings, and paste the domain URL that you see inside your container. Using a custom domain is highly recommended.

tagging server URL
add custom domain

10. Open the GTM Server-Side plugin you installed in the first step and paste tagging URL inside the plugin settings. Next, select if you want to add web GTM to all site pages or just add plugin functionality without adding GTM script (this option should be used in case you are using any other plugin that inserts GTM script on the site). Next, add WEB Google Tag Manager ID, tagging server URL, and stape container identifier if you want to use a custom loader. Select if you want to add data Layer events or send webhooks. 

gtm server-side plugin

11. Save changes, open the console, and check that the web GTM script is served through the tagging server URL. 

tagging server url

12. Once you have a server GTM container for the WordPress site up and running, you can start setting up server-side tagging for needed platforms. For example, we already have blog posts describing setting up server-side Universal Analytics, Google Analytics 4, Facebook, TikTok, Snapchat, etc

Conclusions:Copy link to this section

Server-side tagging is a powerful tracking solution, and with the help of the GTM server-side plugin, you can now easily implement it on your WordPress website. Now that you know what goes into setting up a Google Tag Manager Server-Side Container in WordPress and how it will benefit your website, it’s time to start implementing this powerful tool and take advantage of it. Make sure to keep track of any changes and adjust them as needed for a successful tracking experience. If you have more questions or need assistance, don't hesitate to contact us - we'd be delighted to help you out! 

Thanks for reading. We hope this article was helpful in understanding what is needed from server-side tagging and how to get the most out of it.

Ready to test server-side tagging?

All it takes is a few simple steps. Click Try for Free , and configure your server Google tag Manager container with Stape in just 3 minutes.

Try for free

Host your GTM server at Stape