Getting Started
Setup Guide
Server-Side Google Tag Manager (SGTM)

Create sGTM Container on GTM

  • Go to your Google Tag Manager account.
  • Navigate to Admin and click the plus icon on the right.

Create sGTM container

  • Choose server.

Choose server-side

  • Go to Clients and click New.

Create a new client on your sGTM container

  • Set up your client tag.

This will connect your sGTM container with your current client GTM. So, please make you sure add your current GTM ID, like GTM-XXXXX

Setup your client tag

  • Go to Admin and click Container Settings.

Container settings

  • Visit the Hardal dashboard and copy the Hardal sGTM Container URL.

Copy Hardal sGTM Container URL

  • Paste your Hardal sGTM Container URL.

Add your container URL

Testing your sGTM Container

You can check if your sGTM container is working correctly in two ways.

  • Copy and paste your Hardal sGTM Container URL into your browser and add /healthy to the end of your URL. You should see just OK in your browser.

Testing your sGTM by adding /healthy

Another way to check your container is the debug view.

  • Go to your server-side container workspace and click preview by choosing your current server-side container URL.

sGTM Preview

  • In your Preview screen, click the three-dots icon, then copy your manually sending request cURL code to the terminal and run it.

Sending request manually

  • You should see your test request in your preview sGTM.

See your test event in your preview debug sGTM

Update the script source domain

By default, Tag Manager or the Google tag (gtag.js) loads their dependencies from Google-owned servers, such as (opens in a new tab). You need to update the script URL on your website to load dependencies through Hardal Server.

To load the GTM code via your server container:

    1. Locate the existing Tag Manager code on the page.
    1. Replace the string (opens in a new tab) with the domain name of your tagging server in the <head> and <body> of the Google Tag Manager installation code
  • Head

<!-- Google Tag Manager -->
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
<!-- End Google Tag Manager -->
  • Body
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://<YOUR_HARDAL_CONTAINER_URL>/ns.html?id=TAG_ID"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->

Congratulations 🎊 Your server-side GTM is ready to use.


Do you have any trouble about your container URL? Check our FAQs here or get support us here