Looking to install Server-Side Google Tag Manager in WordPress? If you want to integrate analytics software and marketing applications with your WordPress website without losing any data (due to AdBlockers or ITPs), then Google Tag Manager Server-Side tagging is what you want to use. It allows you to add and run tracking codes via the server environment.
In this article, we’ll explain how to add Google Tag Manager Server-Side Container in WordPress 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 browsers to the server environment.
With Server-Side tagging, you will forget about incomplete data inside Google Analytics or any other website analytics software for that matter. And low page speed due to heavy java scripts on your WordPress site will not be an issue anymore.
Since the product was released 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. Naturally, GA implementation is one of the most important goals for all website owners. But transferring other tags like Facebook, Bing, or AdWords can 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 them via the GTM template library.
What are the main benefits of adding a Server-Side Google Tag Manager Container to WordPress?
1. Bypassing Intelligent Tracking Prevention
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. With Google Analytics implemented on the server environment, you can extend cookie lifetime. And for now, that is the easiest way to reach the goal. If you don’t do that, users who returned to your website after 7 days (or in some cases, 24 hours) will be considered new users. As a result, the data quality inside Google Analytics will decrease.
2. Improved Data Accuracy
3. Improved Page Load Speed
If you are impressed by what Server-Side Google Tag Manager has to offer, then you will be happy to hear that adding GTM Server Container to your WordPress website is effortless with our plugin. The plugin is free; though we offer several pricing plans for our services, you can check the details here.
How to set up Google Tag Manager Server-Side Container in WordPress.
3. Under the container column, click +.
4. Type container name, choose Server and click create.
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.
6. Create an account within our service here
7. Once you received 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.
8. Once you click create, you will see the status of your container, container config, and a 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.”
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 app.stape.io/container/
10. Open the GTM Server-Side plugin that you’ve installed in the first step and paste tagging URL inside plugin settings.
11. You have two options for adding a GTM server container: together with a GTM web container or run only a 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 paste your web container ID. You can find it by logging into your web GTM container; you’ll see the ID in the top right corner. Paste it into the field Google Tag Manager ID. Once it’s done, don’t forget to disable other plugins for the GTM installation.
- 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 -> Paste Transport URL.
That’s it! Now GTM server container is set up on your WordPress website, and GA runs via server environment. If you want to know more about running GA via a custom subdomain to bypass adblockers and ITPs, check this article.
How to Load Google Analytics From a Custom Subdomain in WordPress?
I highly recommend using a custom subdomain for your tagging server, since it will help you improve data accuracy.
1. Log in to your GTM server account and click Add custom domain.
2. Log in to your domain name service and create a new DNS record for the subdomain you want to use.
If you use Cloudflare account. Choose the domain, Click DNS -> Add record
Add these setting:
Name: ss (or any other subdomain name you want)
IPv4 address: 18.104.22.168 (US server location) or 22.214.171.124 (EU server location)
Proxy status: disable
Your settings should look like this:
Once you have done, click Save.
3. Go to your app.stape.io 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”.
4. Once your GTM subdomain is added and verified, you should see the status Running.
5. Go to your Server GTM container -> Admin -> Container Settings -> Change Tagging server URL to your subdomain.
6. 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.
7. Open your GTM Server-Side plugin in WordPress and modify GTM Server-Side URL.
That’s it. Google Analytics on your WordPress website runs from a custom subdomain and is resistant to Ad Blocker and ITPs.