How to Add Google Tag Manager Server-Side Tagging to WordPress.

Looking to install Server-Side Google Tag Manager in WordPress? If you want to integrate analytics software and marketing applications on your WordPress website without losing any data due to AdBlockers or ITPs, then Google Tag Manager Server-Side tagging is definitely what you want to use. It allows you to add and run tracking codes via the server environment.

In this article, we’ll guide you on how to integrate Google Tag Manager Server-Side Container to your WordPress site using our plugin.

What Is Google Tag Manager Server-Side Tagging For WordPress?

Google Tag Manager Server-Side Tagging is a tool from Google released to public beta in summer 2020. It allows you to move 3rd part pixels from the client’s browsers to the server environment. 

With Server-Side tagging, you will forget about incomplete data inside Google Analytics or any other website analytics software and low page speed due to heavy java scripts on your WordPress site. 

Since the product was released to the public only a few months ago, Server Container from Google Tag Manager has only one native client – Universal Analytics. All Server GTM elements like clients, tags, triggers, and variables are solely focused on Google Analytics implementation via the server-side container.  While GA implementation is one of the most important for all website owners, transferring other tags like Facebook, Bing, Adwords, etc. will significantly reduce client load and improve the data quality on your WordPress site.

Most likely, Google will soon create native tags for other platforms, as it did for the web container, or Server GTM users will create custom templates and share it via the GTM template library.

What are the main benefits of adding Server-Side Google Tag Manager Container to WordPress?

1. Browser’s Intelligent Tracking Prevention

Safari and Firefox ITPs restrict the cookie lifetime. Previously your cookie could live up to 2 years, and now this time is limited to 7 days or even 24 hours. With Google Analytics that is implemented on the server environment, you can extend cookie lifetime. And for now, it’s the easiest way of increasing cookie lifetime. If you won’t do that users who returned to your website after 7 days (in some cases 24 hours) will consider as new users. It will decrease the data quality inside Google Analytics.

2. Improved Data Accuracy 

Most WordPress site owners see discrepancies between the number of transactions in Google Analytics and their CRM. It happens due to ad blockers and errors that occur inside client browsers with 3rd party pixels. You can eliminate this problem by moving GA to the Server Container. Your 3rd party cookies will be considered 1st party only if your data is sent within your domain. This article explains the benefit of changing the GA tagging URL to your custom subdomain. Plus no more third-party javascript errors, events will be sent via server. 

3. Improved Page Load Speed

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

If you like the sound of what Server-Side Google Tag Manager has to offer, then you will be happy to hear that it’s straightforward to implement GTM Server Container on your WordPress website via our plugin. The plugin is free; though there are several pricing plans for our service, you can see the difference here

How to set up Google Tag Manager Server-Side Container in WordPress.

  1. Login to your WordPress Admin, and go to the plugins, click “Add New,” type “GTM Server-Side.” Choose this plugin and click install now. Once installed, click Activate.

How to set up Google Tag Manager Server-Side Container in WordPress

2. Create a Google Tag Manager Server container if you don’t have one. Go to https://tagmanager.google.com/ choose the account where you want to create a container. Click Admin.

how to set up server tag manager create container

3. Under the container column, click +.

how to set up server tag manager create server container

 

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

how to set up server tag manager create container name

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

 how to set up server tag manager create container Manually provision tagging server

6. Create an account within our service here: https://app.gtm-server.com/auth/sign-up 

7. Once you received the confirmation email and set your password, it’s time to create a container. Click “Create Container”, enter your container name and past container config that you copied from your Google Tag Manager Server Container. Click Create Container.

how to set up server tag manager create container set up gtm-server

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

how to set up server tag manager config container inside gtm-server

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

If the error repeats, please contact the support.

9. Set up a tagging URL. Inside your Google Tag Manager click admin, select container settings, and past the domain URL that you see inside app.gtm-server.com/container/

how to set up server tag manager set up tagging URL in google tag manager

 

how to set up server tag manager config container inside gtm-server

10. Open GTM Server-Side plugin that you’ve installed in the first step and past tagging URL inside plugin settings.

How to set up Google Tag Manager Server-Side Container in WordPress tagging url

11. You have two options of adding GTM server container: together with GTM web container or run only GTM server container. We recommend choosing the second option, “Add Google Tag Manager web container on all pages. If you have other GTM plugins, please disable them.”

12. If you choose the second option, please past your web container ID. You can find it by logging on to your web GTM container; you’ll see the ID in the top right corner. Past it into the field Google Tag Manager ID. Once done, don’t forget to disable other plugins for the GTM installation.

How to set up Google Tag Manager Server-Side Container in WordPress add GTM ID

13. Update Google Analytics Transport URL inside your web GTM container.  Inside Google Tag Manager Web Container, go to Variables -> Choose your Google Analytics variable -> More Settings -> Advanced Configuration -> Past Transport URL.

how to set up custom domain google tag manager server container update transport url google analytics

Now GTM server container is set up on your WordPress website, and GA runs via server environment. 

How to Load Google Analytics From a Custom Subdomain in WordPress?

If you want to know run Google Analytics via custom subdomain to bypass adblockers and ITPs you’ll need to update to the pro account and do the following steps. 

1. Upgrade your plan to pro. Go to your account and click “Upgrade to Pro”

how to set up custom domain google tag manager server container upgrade plan

2. Once payment is done, please refresh the page. You should see that your plan was upgraded to pro. In case of any error please click settings and save. 

how to set up custom domain google tag manager server container check status

3. Now you need to create a A record for the custom domains. Bellow, you’ll find guide on how to add A record in Cloudflare. 

4. Open your Cloudflare account. Choose the domain, Click DNS -> Add record

5. Add these setting:

Type: A

Name: gtm (or any other subdomain you prefer to have for GTM, if you choose gtm the subdomain will look like gtm.yoursite.com)

IPv4 address: 35.193.123.107

TTL: Auto

Proxy status: disable

Your settings should look like this:

custom subdomain add a record

Once you have done, click Save. 

6. Go to your app.gtm-server.com account and add a custom domain. It should consist of the name that you added to Cloudflare and your domain. Click Save. After adding the domain, it passes through the verification process. It can take up to 72 hours. Once the domain is verified, the status will be changed to “Verified”.

add custom subdomain gtm server

 

7. Once your GTM subdomain is added and verified, you should see the status Running.

how to set up custom domain google tag manager server container running

8. Go to your Server GTM container -> Admin -> Container Settings -> Change Tagging server URL to your subdomain. 

how to set up custom domain google tag manager server container update tagging url

9. Update tagging URL inside Google Analytics Tags or Google Analytics Variable inside your GTM web container. Open Google Analytics Tag -> More Settings -> Advanced Configuration -> Past your GTM subdomain inside Transport URL. 

how to set up custom domain google tag manager server container update transport url google analytics

10. Open you GTM Server-Side plugin in WordPress and modify GTM Server-Side url. 

Load Google Analytics From a Custom Subdomain in WordPress

That’s it. Google Analytics on your WordPress website runs from a custom subdomain and is resistant to Ad Blocker and ITPs.