# Google Tag Manager integration

{% hint style="info" %}
The Freshpaint GTM Integration supports **Client-side GTM** configuration&#x73;**.** [Server-side GTM](https://developers.google.com/tag-platform/tag-manager/server-side) is not supported, but Freshpaint can help you migrate from Server-side GTM to Freshpaint tags on Client-side GTM.
{% endhint %}

Google Tag Manager (GTM) does not intrinsically offer protection against [Protected Health Information](https://www.hhs.gov/answers/hipaa/what-is-phi/index.html) (PHI) being sent to destinations like Google Analytics or Google Ads, when using native GTM tag types.

Freshpaint offers a way for you to continue using Google Tag Manager with supported Freshpaint destinations in a HIPAA-compliant way, by using Freshpaint's GTM Custom Template.

The currently supported GTM tag types and corresponding Freshpaint GTM Template Destinations (displayed as "Freshpaint Tag Type" in the template) are:

| GTM Tag Type                                                                                  | Freshpaint GTM Template Destination         |
| --------------------------------------------------------------------------------------------- | ------------------------------------------- |
| <p>Google Tag</p><p>Google Analytics: GA4 Event</p>                                           | Google Analytics 4 (Proxy)                  |
| Google Ads Conversion Tracking                                                                | Google Ads                                  |
| Google Ads Call Conversions                                                                   | N/A                                         |
| Google Floodlight Counter                                                                     | Google Campaign Manager 360 Conversions API |
| Facebook Pixel (from Gallery Template or Custom HTML)                                         | Facebook Conversions API                    |
| Microsoft Advertising Universal Event Tracking                                                | Bing Ads                                    |
| Basis                                                                                         | Basis                                       |
| <p>LinkedIn Insight (from LinkedIn Insight, <br>LinkedIn Insight Tag 2.0, or Custom HTML)</p> | LinkedIn Ads Conversion API                 |
| impact.com Pixel (from custom HTML)                                                           | impact.com                                  |
| TikTok (from Gallery Template)                                                                | TikTok Ads                                  |
| N/A                                                                                           | Reddit Ads                                  |
| N/A                                                                                           | Pinterest Ads                               |
| Twitter Universal Website Tag                                                                 | Twitter Ads                                 |
| StackAdapt conversion (from Custom HTML)                                                      | Stack Adapt                                 |
| theTradeDesk conversion via static tracking tag (from Custom HTML)                            | theTradeDesk                                |

### How it works

A typical GTM configuration looks something like this:

<div data-full-width="true"><figure><img src="https://1666823438-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MA7aDqsXMFbUsWVqonF%2Fuploads%2FAhy5mwkWAcq3uFDehtxT%2FScreenshot%202023-05-23%20at%2011.24.38%20AM.png?alt=media&#x26;token=bb144b8a-d59f-4dc9-9d91-5b1fb39fc8c2" alt=""><figcaption></figcaption></figure></div>

A given tag using a GTM native tag type is changed to a Freshpaint-template tag type, specifying the Freshpaint destination (e.g., Google Ads), preserving the same trigger and parameter settings, along with specifying a [Freshpaint Environment ID](https://documentation.freshpaint.io/faqs/where-do-i-find-my-environment-id).

{% hint style="info" %}
The destinations of interest (Google Ads, Facebook CAPI, etc.) must be separately configured in Freshpaint.
{% endhint %}

When the GTM trigger fires for the Freshpaint-template tag, this results in a Freshpaint SDK [track](https://documentation.freshpaint.io/integrations/sources/web/precision-tracking) call, which generates a [precision event](https://documentation.freshpaint.io/integrations/sources/web/precision-tracking), delivered only to the designated Freshpaint destination.

{% hint style="info" %}
The Freshpaint SDK snippet must be loaded either directly on your page (prior to the GTM snippet), or via a Custom HTML Tag in GTM. If the latter, use the Initialization trigger type to ensure the snippet is loaded prior to any Page-View-triggered Freshpaint event tags (and don't use GTM SetUp tags pointing to the SDK snippet tag, except for Freshpaint addEventProperties tags, if any)
{% endhint %}

During Freshpaint’s processing of the event, if in HIPAA mode,  [HIPAA Mode](https://documentation.freshpaint.io/readme/hipaa-mode) Allowlists are evaluated to allow only properties you've designated safe before sending to the destination. You'll need to add properties to the Allowlist to enable the sending of those properties to the destination.

Here's how it looks when using the Freshpaint GTM Template, with HIPAA Mode enabled:

<div data-full-width="true"><figure><img src="https://1666823438-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MA7aDqsXMFbUsWVqonF%2Fuploads%2FgGQNxXHcrTUOTRLYOrWJ%2FScreenshot%202023-05-23%20at%2011.25.02%20AM.png?alt=media&#x26;token=0d7d7d9b-9636-40ea-8b0e-f41fcea5bdac" alt=""><figcaption></figcaption></figure></div>

### Migration Procedure

There are two ways to migrate at this time:

* Manual
* Automated (run by Freshpaint)

The **Manual** approach can work when there are a small number of tags, or if trying a small initial trial set. You can perform this yourself in your GTM account. The steps for this are:

* Configure each destination of interest in Freshpaint
* Add the Freshpaint GTM template to your GTM container, by searching the Community Template Gallery and adding it to your GTM workspace
* Modify one or more native-GTM tags to be their Freshpaint template equivalent:
  * **Approach 1: Edit existing tag in-place**
    * `Tag Type`: Select Freshpaint
    * `Freshpaint Tag Type`: Select appropriate Freshpaint Tag Type (e.g., Google Ads)
    * Enter tag-type-specific parameter settings
  * **Approach 2: Create separate Freshpaint tag**&#x20;
    * Rename existing GTM-native tag, and mark it Paused
    * Create new GTM tag with the original tag name
    * `Tag Type`: Select Freshpaint
    * `Freshpaint Tag Type`: Select appropriate Freshpaint Tag Type (e.g., Google Ads)
    * Enter tag-type-specific parameter settings
    * Create same trigger(s) as GTM-Native tag

The **Automated** approach is recommended when there are a large number of tags in your GTM workspace. The Freshpaint Support team makes the changes using an automated script against the GTM API, and coordinates with you to review the changes. Contact <support@freshpaint.io> to get started.

Here is an overview of how the automated migration works:

* Ensures the Freshpaint GTM Template is installed
* Supports specifying one or more filtering include and / or exclude GTM-folders, destination types, etc.
* Excludes paused GTM tags by default
* Supports a dry-run mode, making it possible to review changes without altering your GTM workspace
* For each supported tag type, replaces the native GTM tag type with a Freshpaint GTM tag type
* Creates any destination instances which are not yet configured, and reports any GTM tag properties that may need to be allowlisted
* Creates draft changes in the GTM workspace. After you review the changes you can submit them to be published as the live version.
* Supports migrating from a Server-side GTM container to Client-side GTM
* Supports an optional interim Side-by-side migration

### Freshpaint Google Tag Manager Destination not supported with Freshpaint GTM Template

The [Google Tag Manager](https://documentation.freshpaint.io/integrations/destinations/apps/google-tag-manager) destination allows you to send any Freshpaint event to GTM (with properties filtered by Allowlists, if in [HIPAA Mode](https://documentation.freshpaint.io/readme/hipaa-mode)), where it may be used as a Custom Event trigger for any GTM tag.

{% hint style="warning" %}
Using the Freshpaint GTM Template and the Google Tag Manager Destination at the same time is not currently supported.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documentation.freshpaint.io/integrations/google-tag-manager-integration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
