---
title: Google Analytics / Google Tag Manager
slug: experience/google-analytics-google-tag-manager
description: Learn about the official websites and developer integrations for Google Analytics in this document. Discover the supported events, configurations, tracking structure, and more. Explore how to configure actions, views, and purchases in Google Analytics 4, 
docTags: 
createdAt: 2023-09-04T10:58:28.834Z
---

## Official websites

| **Site**      | **URL**                                                                                                                                                                                                                                                                                                                                                                  |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Website       | [https://developers.google.com/analytics](https://developers.google.com/analytics)                                                                                                                                                                                                                                                                                       |
| Documentation | PXP implements two options that can be implemented on the web. These are:<br />* via **Google Analytics 4**
  - [https://support.google.com/analytics/answer/9304153](https://support.google.com/analytics/topic/14088998)
* via **Google Tag Manager**
  - [https://support.google.com/tagmanager/answer/6102821](https://support.google.com/tagmanager/answer/6102821) |

## Developer integrations

| **Platform** | **URL**                                                                                                                                                                                                                                                                                                                                                                                        |
| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Android      | <font color="#ff6900">not supported</font>                                                                                                                                                                                                                                                                                                                                                     |
| iOS          | <font color="#ff6900">not supported</font>                                                                                                                                                                                                                                                                                                                                                     |
| Web          | [https://developers.google.com/analytics/devguides/collection/ga4](https://developers.google.com/analytics/devguides/collection/ga4)<br /><br />PXP implements two options that can be implemented on the web. These are:<br />* via **Google Analytics 4**<font color="#9900ef">*****</font>
* via **Google Tag Manager**<font color="#9900ef">*****</font><font color="#9900ef">*****</font> |

<font color="#9900ef">(*) </font>Available since **PXP 3.7.0**

<font color="#9900ef">(</font><font color="#9900ef">*</font><font color="#9900ef">*</font><font color="#9900ef">) </font>Available since **PXP 4.0.0**

# Tracking service

## Event support matrix

Overview of the supported events and their configuration.

|                                          | **Templates**                                                                                                                                                                    | **Parameter**                                |
| ---------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------- |
| <font color="#2166ae">**Actions**</font> | <font color="#3b9f0f">*trigger*</font><font color="#9900ef">*</font><font color="#3b9f0f">
*action
label
category*</font>                                                        | <font color="#3b9f0f">supported </font>(Web) |
| <font color="#2166ae">**Views**</font>   | <font color="#3b9f0f">*trigger*</font><font color="#9900ef">*</font><font color="#3b9f0f">
*name*</font><br /><font color="#3b9f0f">*title*</font><font color="#9900ef">*</font> | <font color="#3b9f0f">supported </font>(Web) |

<font color="#2166ae">**Purchases**</font> and <font color="#2166ae">**Attributes**</font> are not supported.

<font color="#9900ef">(*)</font><font color="#0C121D"> The </font><font color="#3b9f0f">*trigger*</font><font color="#0C121D"> and </font><font color="#3b9f0f">*title*</font><font color="#0C121D"> templates are used by Google Tag Manager only.</font>

## General structure in tracking\_config.json

:::hint{type="info"}
The tracking service key name in "*tracking\_config.json*" is:
"<font color="#2166ae">**google_analytics**</font>"
:::

:::CodeblockTabs
General structure

```json
{
  
  "google_analytics": {
    "eventsEnabledByDefault": true,
    "viewsEnabledByDefault": true,
    "purchasesEnabledByDefault": false,
    "attributesEnabledByDefault": false,
    
    "events": {
      // your configured list of events
    },
    
    "views": {
      // your configured list of events
    },
    
    "purchases": {},
    
    "attributes": {} 
    
  }
  
}
```
:::

## Event Configuration

### Actions

Google Analytics 4 / Google Tag Manager supports action events. More informations for Action Events can be found here: [https://app.archbee.com/docs/qtjKveW7g556Yo3qfoyAY/8rrA4o7Vzdaw13Y-JOqEk](https://app.archbee.com/docs/qtjKveW7g556Yo3qfoyAY/8rrA4o7Vzdaw13Y-JOqEk)

:::CodeblockTabs
Action event

```json
"action_event_key": {
  "templates": {
    "trigger": "The name of the trigger in Google Tag Manager",   
    "action": "value of template",   
    "category": "value of template",
    "label": "value of template"
  },
  "parameters": {
    "parameter_key_1": "value of parameter",

    // your configured list of parameters (supported via web only)
  }
}
```

Example

```json
"ISSUE_DOWNLOADED": {
  "templates": {
    "action": "issue_downloaded_{{ISSUE_NAME}}",
    "category": "epaper",
    "label": "Issue downloaded"
  }
}
```

Example with parameters

```json
"ISSUE_DOWNLOADED": {
  "templates": {
    "action": "issue_downloaded_{{ISSUE_NAME}}",
    "category": "epaper",
    "label": "Issue downloaded"
  },
  "parameters": {
    "issue_id": "{{ISSUE_ID}}",
    "issue_name": "{{ISSUE_NAME}}",
    "issue_categories": "{{ISSUE_CATEGORIES}}",
    "issue_tags": "{{ISSUE_TAGS}}",
    "issue_purchasable": "{{ISSUE_PURCHASABLE}}",
    "issue_purchased": "{{ISSUE_PURCHASED}}",
    "publication_id": "{{PUBLICATION_ID}}",
    "publication_name": "{{PUBLICATION_NAME}}"
  }
}
```
:::

**Templates**

| **Template key**                      | **Required**                         | **Template value**                             |
| ------------------------------------- | ------------------------------------ | ---------------------------------------------- |
| <font color="#3b9f0f">trigger</font>  | **no**                               | The name of the trigger in Google Tag Manager. |
| <font color="#3b9f0f">category</font> | <font color="#eb144c">**yes**</font> | The category of the event.                     |
| <font color="#3b9f0f">action</font>   | <font color="#eb144c">**yes**</font> | The action of the event.                       |
| <font color="#3b9f0f">label</font>    | <font color="#eb144c">**yes**</font> | The label of the event.                        |

**Parameters**

| **Parameter name**         | **Template value**          |
| -------------------------- | --------------------------- |
| The name of the parameter. | The value of the parameter. |

### Views

Google Analytics 4 / Google Tag Manager support view events. For the "view\_event\_key" additional information can be found here: [](https://app.archbee.com/docs/qtjKveW7g556Yo3qfoyAY/mIXE5-IjKbR47eUmMdyga#3Tm1p)

:::CodeblockTabs
View event

```json
"view_event_key": {
  "templates": {
    "trigger": "The name of the trigger in Google Tag Manager",   
    "name": "value of template",  
    "title": "value of template"
  },
  "parameters": {
    "parameter_key_1": "value of parameter",

    // your configured list of parameters (supported via web only)
  }  
}
```

Example Google Analytics 4

```json
"STOREFRONT_FEED": {
  "templates": {
    "name": "feed"
  }
}
```

Example Google Tag Manager

```json
"STOREFRONT_FEED": {
  "templates": {
    "name": "feed",  
    "title": "My Feed",
  }  
}
```
:::

**Templates**

| **Template key**                     | **Required** | **Template value**                                                                                                                                                                                                                                                                                                                                 |
| ------------------------------------ | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <font color="#3b9f0f">trigger</font> | **no**       | The name of the trigger in Google Tag Manager.                                                                                                                                                                                                                                                                                                     |
| <font color="#3b9f0f">name</font>    | **no**       | The name of the view.<br /><br />Used by Google Tag Manager only.                                                                                                                                                                                                                                                                                  |
| <font color="#3b9f0f">title</font>   | **no**       | The title of the page. This value overrides the default value. <br /><br />*How the default value is created:*<br />Titles for content on the web are generated using a complex algorithm involving several preprocessing software components. This results in the title-tag within the html document. Matomo in web uses its value as page title. |

**Parameters**

| **Pameter name**           | **Template value**          |
| -------------------------- | --------------------------- |
| The name of the parameter. | The value of the parameter. |

### Purchases

Google Analytics 4 / Google Tag Manager does not support purchase events.

### Attributes

Google Analytics 4 / Google Tag Manager does not support attributes.

## Additional supported functionality

No additional functionality is currently supported.

# How to configure

## Native Purple App

### Enable SDK

Google Analytics does not provide a standalone native integration. To use Google Analytics in your native apps, you must do so through [Firebase](docId\:UTcmD84EbM3lbU7yBWE_S) .

### Apple privacy / ATT

Since there is no native SDK available in the apps, there is no ATT-controlled behavior.

### Consent Management

Since there is no native SDK available in the apps, there is no CMP-controlled behavior.

## Web integration

:::hint{type="info"}
You can use the [Purple Experience Builder](docId\:KMuf0oag3Of3A46iUp5q4) to edit the "*experience.config.json*".
:::

Google Analytics is not explicitly enabled. If a valid configuration of Google Analytics is present in the "*experience.config.json*", the SDK is integrated into the HTML document.&#x20;

This can be  done either as **Google Analytics 4** or as **Google Tag Manager**. The corresponding configurations differ as follows:

**Structure in experience.config.json**

:::CodeblockTabs
Google Analytics 4

```json
{
  "purple": {
    "analytics": {
    
      "ga4": {
        "configuration": {
          "measurementId": "Provided by Google Analytics 4"
        }
      }
      
    }
  }
}
```

Google Tag Manager

```json
{
  "purple": {
    "analytics": {
    
      "ga4": {
        "configuration": {
          "useTagManager": true,
          "addNoScript": true | false,
          "containerId": "Provided by Google Tag Manager"
        }
      }
      
    }
  }
}
```
:::

*Google Analytics 4*

| **Setting**   | **Description**                       |
| ------------- | ------------------------------------- |
| measurementId | Measurement id of your connected GA4. |

*Google Tag Manager*

| **Setting**   | **Description**                                                               |
| ------------- | ----------------------------------------------------------------------------- |
| useTagManager | Enables the Google Tag Manager instead of Google Analytics 4                  |
| addNoScript   | Add the noscript iframe element to the body-element. <br />Default is "false" |
| containerId   | The id of the connected container.                                            |

:::hint{type="info"}
When using the **Google Tag Manager&#x20;**&#x61; further setup at **Google Tag Manager Dashboard** is needed. Please read on more here:

[Google Tag Manager Setup guide](docId\:V33eMKmuLYt1yW-V4yfn2)&#x20;
:::

### Consent management

If you use one of the CMPs supported by Purple, you must specify the CMP-specific  vendor id for Google Analytics, which you can get from your CMP frontend. Additionally, the IAB vendor id for Google Analytics can also be added.

**Structure in experience.config.json**

:::CodeblockTabs
Google Analytics with consent

```json
{
  "purple": {
    "analytics": {
    
      "ga4": {
        "configuration": {
          "measurementId": "Provided by Google Analytics 4"
        },
        "consent": {
          "vendorId": "Provided by your CMP",
          "iabVendorId": ""
        }
      }
      
    }
  }
}
```

Google Tag Manager with consent

```json
{
  "purple": {
    "analytics": {
    
      "ga4": {
        "configuration": {
          "useTagManager": true,
          "addNoScript": true | false,
          "containerId": "Provided by Google Tag Manager"
        },
        "consent": {
          "vendorId": "",
          "iabVendorId": ""
        }
      }
      
    }
  }
}
```
:::

*Consent*

| **Setting** | **Description**                    |
| ----------- | ---------------------------------- |
| vendorId    | The vendor ID managed by your CMP. |
| iabVendorId | The vendor ID managed by IAB.      |

