---
title: MGID Server-Side Google Tag Manager Template
description: Installing the MGID Server-Side Google Tag Manager (GTM) template into a GTM Server Container. When set up correctly, advertisers get more reliable attribution, improved privacy compliance, and fewer ad-blocking issues.
---

[Skip to content](https://help.mgid.com/mgid-server-side-google-tag-manager-template#main-content)

- [English](https://help.mgid.com/mgid-server-side-google-tag-manager-template)
- [Italiano](https://help.mgid.com/it/mgid-server-side-google-tag-manager-template)
- [Português - Brasil](https://help.mgid.com/pt-br/mgid-server-side-google-tag-manager-template)

English

Show submenu for translations

![MGID\_Logo\_Help\_Center\_W\_R\_Swoosh.svg\]](https://help.mgid.com/hubfs/MGID_Logo_Help_Center_W_R_Swoosh.svg)

- [Advertisers](https://www.mgid.com/advertisers)
- [Publishers](https://www.mgid.com/publishers)
- [Contact Us](https://www.mgid.com/about#tabs-contactus)

Open main navigation

Close main navigation

- [Advertisers](https://www.mgid.com/advertisers)
- [Publishers](https://www.mgid.com/publishers)
- [Contact Us](https://www.mgid.com/about#tabs-contactus)
- - [English](https://help.mgid.com/mgid-server-side-google-tag-manager-template)
    - [Italiano](https://help.mgid.com/it/mgid-server-side-google-tag-manager-template)
    - [Português - Brasil](https://help.mgid.com/pt-br/mgid-server-side-google-tag-manager-template)

  English
  
  Show submenu for translations
- Contact us

 Contact us

 Welcome to MGID! How can we help you?

- There are no suggestions because the search field is empty.

1. [Help Center Home](https://help.mgid.com/?hsLang=en)
2. [Advertisers](https://help.mgid.com/advertisers?hsLang=en)
3. [Postback & Trackers](https://help.mgid.com/advertisers?hsLang=en#postback-trackers)

# MGID Server-Side Google Tag Manager Template

[Stage 1:  Preparation (what the advertiser must do first)](https://help.mgid.com/mgid-server-side-google-tag-manager-template#toc1)  
[Stage 2: MGID Template Configuration and Installation](https://help.mgid.com/mgid-server-side-google-tag-manager-template#toc2)  
[Stage 2.1. Page view tag: Capture Click ID on arrival](https://help.mgid.com/mgid-server-side-google-tag-manager-template#toc2_1)  
[Stage 2.2. Conversion tag: Send conversions back to MGID](https://help.mgid.com/mgid-server-side-google-tag-manager-template#toc2_2)  
[Stage 3: Verification (before publishing)](https://help.mgid.com/mgid-server-side-google-tag-manager-template#toc3)

This guide walks your technical or marketing team step-by-step through installing the MGID Server-Side Google Tag Manager (GTM) template into a GTM Server Container. With this template, advertisers experience more reliable attribution, improved privacy compliance and fewer ad-blocking issues.

### Stage 1:  Preparation (what the advertiser must do first)

Before installing the template, please ensure the following items are in place.

1\. A **GTM Server Container** (App Engine or Cloud Run) is required to use the MGID server-side GTM template.

Review the Tag Manager instruction: [Set up a server container](https://developers.google.com/tag-platform/tag-manager/server-side)

2\. Map the Server Container to a **same-site subdomain** of your website (example: gtm-server.example.com for example.com). Note that cookies set from a different domain are considered third-party cookies and will be blocked.

Review the Tag Manager instruction: [Map a custom domain](https://developers.google.com/tag-platform/tag-manager/server-side/custom-domain)

3\. Grant **publish permission** toensure the person setting up the Server Container also has permission to publish it.

### Stage 2: MGID Template Configuration and Installation

##### Stage 2.1. Page view tag: Capture Click ID on arrival

This tag ensures the Click ID is stored immediately upon arrival. To set up the Page view tag, follow these steps:

1. In the Server Container, create a **New Tag** and select **MGID Server-Side Tag**.
2. Set **Event Type** to **PageView**.
3. **Triggering:** Fire on **All Page Views**.
4. **Save** as "MGID - PageView".

##### Stage 2.2. Conversion tag: Send conversions back to MGID

This tag sends the data back to MGID. To set up the Conversion tag, follow these steps:

1. In the Server Container, create a **New Tag** and select **MGID Server-Side Tag**.
2. Set **Event Type** to Conversion.
3. Enter the **Event Name** (or example purchase). **Note:** Use only Latin letters, numbers, hyphens and underscores.
4. (Optional) Map a **Conversion Value**.
5. **Triggering:** Fire on your conversion event (e.g., **Event Name equals purchase**).
6. **Save** as "MGID - Conversion".

### Stage 3: Verification (before publishing)

Before you publish, validate the setup in Server Preview:

1. In the GTM Server Container, click **Preview** to open the Server Debugger.
2. In the browser, simulate page visits and conversion flows (example: visit https://example.com/?adclid=test).
3. In Server Debugger:

- Confirm **PageView** request arrived and **MGID  PageView** fired.
- Confirm a cookie named **MgidSensorClid** was set.
- Confirm **Conversion** request fired and an outgoing request to https://a.mgid.com/postback returned **200**.
- Check template console logs for success/error messages (e.g., “Click ID found in page\_location”, or “ERROR: Click ID is required…”).

Review the Tag Manager instruction: [Server-side Preview Mode Guide](https://developers.google.com/tag-platform/tag-manager/server-side/debug)

For advanced TechOps help or account-specific questions, please contact your **MGID Account Manager**.

- [Advertisers](https://help.mgid.com/advertisers?hsLang=en#main-content)

    - [Get started with MGID Ads](https://help.mgid.com/advertisers?hsLang=en#get-started-with-mgid-ads)
    - [Campaign Setup & Management](https://help.mgid.com/advertisers?hsLang=en#campaign-setup-management)
    - [CPA Tune](https://help.mgid.com/advertisers?hsLang=en#cpa-tune)
    - [Conversion tracking: general](https://help.mgid.com/advertisers?hsLang=en#conversion-tracking-general)
    - [Tracking with MGID Pixel](https://help.mgid.com/advertisers?hsLang=en#tracking-with-mgid-pixel)
    - [Postback & Trackers](https://help.mgid.com/advertisers?hsLang=en#postback-trackers)
    - [Affiliate Networks Integration](https://help.mgid.com/advertisers?hsLang=en#affiliate-networks-integration)
    - [Webhook tracking method & Integrations](https://help.mgid.com/advertisers?hsLang=en#webhook-tracking-method-integrations)
    - [Native integrations](https://help.mgid.com/advertisers?hsLang=en#native-integrations)
    - [Ad Creatives Management](https://help.mgid.com/advertisers?hsLang=en#ad-creatives-management)
    - [Campaign Optimization & Performance](https://help.mgid.com/advertisers?hsLang=en#campaign-optimization-performance)
    - [FAQ](https://help.mgid.com/advertisers?hsLang=en#faq)
    - [MGID Video Guides](https://help.mgid.com/advertisers?hsLang=en#mgid-video-guides)
- [Publishers](https://help.mgid.com/publishers?hsLang=en#main-content)

    - [General](https://help.mgid.com/publishers?hsLang=en#general)
    - [Prohibited content and practices](https://help.mgid.com/publishers?hsLang=en#prohibited-content-and-practices)
    - [Types of integration](https://help.mgid.com/publishers?hsLang=en#types-of-integration)
    - [Compliance](https://help.mgid.com/publishers?hsLang=en#compliance)
    - [Payment](https://help.mgid.com/publishers?hsLang=en#payment)
    - [FAQ](https://help.mgid.com/publishers?hsLang=en#faq)
- [Ad Quality Policies and Creative Guidelines](https://help.mgid.com/ad-quality-policies-and-creative-guidelines?hsLang=en#main-content)

    - [Ad Approval & Compliance Guidelines](https://help.mgid.com/ad-quality-policies-and-creative-guidelines?hsLang=en#ad-approval-compliance-guidelines)
    - [Creative AI Hub](https://help.mgid.com/ad-quality-policies-and-creative-guidelines?hsLang=en#creative-ai-hub)
    - [Creative Hub](https://help.mgid.com/ad-quality-policies-and-creative-guidelines?hsLang=en#creative-hub)
    - [Compliance & Security](https://help.mgid.com/ad-quality-policies-and-creative-guidelines?hsLang=en#compliance-security)
- [Advertisers Super Client Account](https://help.mgid.com/advertisers-super-client-account?hsLang=en#main-content)

    - [Clients](https://help.mgid.com/advertisers-super-client-account?hsLang=en#clients)
- [Fraud Prevention](https://help.mgid.com/fraud-prevention?hsLang=en#main-content)

    - [Fraud Prevention](https://help.mgid.com/fraud-prevention?hsLang=en#fraud-prevention)
- [API](https://help.mgid.com/api?hsLang=en)
- [DSP](https://help.mgid.com/dsp?hsLang=en)
- [SSP](https://help.mgid.com/ssp?hsLang=en)

- [Advertisers](https://www.mgid.com/advertisers)
- [Publishers](https://www.mgid.com/publishers)
- [Contact Us](https://www.mgid.com/about#tabs-contactus)

[![Chill listening crop-3](https://help.mgid.com/hubfs/MGID_Logo_Icon_HC.svg "Chill listening crop-3")](https://www.mgid.com)

Native performance through innovation

<https://facebook.com/mgidglobal/> <https://twitter.com/mgid/> <https://www.linkedin.com/company/mgid-inc->

Copyright © 2026, MGID Inc.