---
title: "Using Google Analytics"
slug: "using-google-analytics"
updated: 2024-02-29T22:41:33Z
published: 2024-02-29T22:41:33Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://help.tritondigital.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Using Google Analytics

**Note:**Google has **deprecated the use of "Universal Analytics."** As of July 1, 2023 you must use **GA4 tags** instead.

You can link the player to your Google Analytics account to receive analytics data regarding **Play**, **Stop**, **Pause**, and **Resume** events.

Analytics is controlled in the embed code for the media player in the**[var tdPlayerConfig](/v1/docs/embedding-the-td-web-player-sdk)**section. If you plan to use Google Analytics, add the `analytics` section from the code example below to the embed code, then customize the properties.

```javascript
        var tdPlayerConfig = {
               analytics: {
            active: true,
            debug: false,
            appInstallerId: 'tdinstallapp',            
            trackingId: 'G-AABBCCD64L',
            trackingEvents: [ 'play', 'stop', 'pause', 'resume', 'all' ],
            sampleRate: 5,     
            category: 'Triton SDK' 
      },
      coreModules: [{
            id: 'MediaPlayer',
            playerId: 'td_container'
      }],
      playerReady: onPlayerReady,
      configurationError: onConfigurationError,
      moduleError: onModuleError,
      adBlockerDetected: onAdBlockerDetected
    };
```

#### Properties

Customize the following properties to enable Google Analytics on your player:

| **Property** | **Type/Options** | **Description** |
| --- | --- | --- |
| **active** | Boolean (true\|false) | **true**= log to Google Analytics. **false**= do not log to Google Analytics. |
| **debug** | Boolean (true\|false) | **true**= data is sent to the Google Analytics debug endpoint. **false**= data not sent to the Google Analytics debug endpoint |
| **appInstallerId** | (String) | Optional. E.g.,**com.platform.vending** |
| **trackingId** | (String) | Your unique GA4 tracking tag. |
| **trackingEvents** | (String) | List of events to track. (**[ 'play', 'stop', 'pause', 'resume', 'all' ]**) Default is**'all'**. |
| **category** | (String) | The Google Analytics event category. |
| **sampleRate** | (0-100) | Percentage of users to be sampled for tracking. Default is**5**. |
