# Google Analytics

## Overview

Google Analytics tracking is configurable on a license-level: the same Google Analytics Tracking ID will be applied to all your Display instances in the same license, once configured.

## Events

All events are tracked to the **iPaper Display** category in the following format:

```javascript
gtag('event', [EVENT NAME], {
	event_category: 'iPaper Display',
	event_action: [ACTION],
	event_label: [LABEL],
	non_interaction: [IS NON INTERACTIVE]
});
```

{% hint style="info" %}
**Note:**

Google Analytics 4 (GA4) does not by default collect event categories, so event names in GA4 have ‘ipd\_’ prepended for iPaper Display events
{% endhint %}

{% hint style="info" %}
**Note:**

When using Google Analytics 4 (GA4), the contents of event\_label are also sent as individual event parameters prepended with ‘ip\_’
{% endhint %}

### Overview <a href="#overview-1" id="overview-1"></a>

{% hint style="info" %}
**Note:**

Dependent on whether you are using Universal Analytics (UA) or Google Analytics 4 (GA4) the event names will be slightly different
{% endhint %}

<table><thead><tr><th width="127">UA event name</th><th width="130">GA4 event name</th><th width="114">Interactive</th><th width="237">Data</th><th>Comments</th></tr></thead><tbody><tr><td><strong>Instance</strong></td><td></td><td></td><td></td><td></td></tr><tr><td>Load</td><td>ipd_load</td><td>No</td><td><p></p><pre class="language-javascript"><code class="lang-javascript">{
  Url: [DISPLAY_URL]
}
</code></pre></td><td></td></tr><tr><td>Time Spent</td><td>ipd_time_spent</td><td>No</td><td><p></p><pre class="language-javascript"><code class="lang-javascript">{
  Duration: [DURATION_IN_SECONDS]
}
</code></pre></td><td></td></tr><tr><td><strong>Button entity</strong></td><td></td><td></td><td></td><td></td></tr><tr><td>Button Click</td><td>ipd_button_click</td><td>Yes</td><td><p></p><pre class="language-javascript"><code class="lang-javascript">{
  ActionUrl: [BUTTON_ENTITY_ACTION_URL]
}
</code></pre></td><td></td></tr><tr><td><strong>Image entity</strong></td><td></td><td></td><td></td><td></td></tr><tr><td>Image Click</td><td>ipd_image_click</td><td>Yes</td><td><p></p><pre class="language-javascript"><code class="lang-javascript">{
  ActionUrl: [IMAGE_ENTITY_ACTION_URL],
  AssetUrl: [IMAGE_ENTITY_ASSET_URL]
}
</code></pre></td><td></td></tr><tr><td><strong>Product entity</strong></td><td></td><td></td><td></td><td></td></tr><tr><td>Product Click</td><td>ipd_product_click</td><td>Yes</td><td><p></p><pre class="language-javascript"><code class="lang-javascript">{
  Id: [PRODUCT_ENTITY_PRODUCT_ID],
  ActionUrl: [PRODUCT_ENTITY_PRODUCT_URL]
}
</code></pre></td><td></td></tr><tr><td><strong>Instance</strong></td><td></td><td></td><td></td><td></td></tr><tr><td>Video Click</td><td>ipd_video_click</td><td>Yes</td><td><p></p><pre class="language-javascript"><code class="lang-javascript">{
  ActionUrl: [VIDEO_ENTITY_ACTION_URL],
  AssetUrl: [VIDEO_ENTITY_ASSET_URL]
}
</code></pre></td><td>Only available for autoplaying video. <code>ActionUrl</code> is only present if the entity has an action assigned to it.</td></tr><tr><td>Video Start</td><td>ipd_video_start</td><td>Yes</td><td><p></p><pre class="language-javascript"><code class="lang-javascript">{
  ActionUrl: [VIDEO_ENTITY_ACTION_URL],
  AssetUrl: [VIDEO_ENTITY_ASSET_URL]
}
</code></pre></td><td>Only available for non-autoplaying video. Fires once per video entity, when a user manually plays video. <code>ActionUrl</code> is only present if the entity has an action assigned to it.</td></tr><tr><td>Video Played 25 Percent</td><td>ipd_video_played_25_percent</td><td>Yes</td><td><p></p><pre class="language-javascript"><code class="lang-javascript">{
  ActionUrl: [VIDEO_ENTITY_ACTION_URL],
  AssetUrl: [VIDEO_ENTITY_ASSET_URL]
}
</code></pre></td><td>Only available for non-autoplaying video. Fires once per video entity, once the timestamp of a video exceeds the stated percentage of its total duration. <code>ActionUrl</code> is only present if the entity has an action assigned to it.</td></tr><tr><td>Video Played 50 Percent</td><td>ipd_video_played_50_percent</td><td>Yes</td><td><p></p><pre class="language-javascript"><code class="lang-javascript">{
  ActionUrl: [VIDEO_ENTITY_ACTION_URL],
  AssetUrl: [VIDEO_ENTITY_ASSET_URL]
}
</code></pre></td><td>Only available for non-autoplaying video. Fires once per video entity, once the timestamp of a video exceeds the stated percentage of its total duration. <code>ActionUrl</code> is only present if the entity has an action assigned to it.</td></tr><tr><td>Video Played 75 Percent</td><td>ipd_video_played_75_percent</td><td>Yes</td><td><p></p><pre class="language-javascript"><code class="lang-javascript">{
  ActionUrl: [VIDEO_ENTITY_ACTION_URL],
  AssetUrl: [VIDEO_ENTITY_ASSET_URL]
}
</code></pre></td><td>Only available for non-autoplaying video. Fires once per video entity, once the timestamp of a video exceeds the stated percentage of its total duration. <code>ActionUrl</code> is only present if the entity has an action assigned to it.</td></tr><tr><td>Video Played 100 Percent</td><td>ipd_video_played_100_percent</td><td>Yes</td><td><p></p><pre class="language-javascript"><code class="lang-javascript">{
  ActionUrl: [VIDEO_ENTITY_ACTION_URL],
  AssetUrl: [VIDEO_ENTITY_ASSET_URL]
}
</code></pre></td><td>Only available for non-autoplaying video. Fires once per video entity, once the timestamp of a video exceeds the stated percentage of its total duration. <code>ActionUrl</code> is only present if the entity has an action assigned to it.</td></tr></tbody></table>

### Example <a href="#example" id="example"></a>

For example, when somebody clicks on a button in your Display, we will track it as such via the “Button Click” event:

**Universal Analytics (UA):**

```javascript
gtag('event', 'Button Click', {
	event_category: 'iPaper Display',
	event_action: 'Button Click',
	event_label: 'Url: https://wwww.ipaper.io/',
	non_interaction: true
});
```

**Google Analytics 4 (GA4):**

```javascript
gtag('event', 'ipd_button_click', {
	event_category: 'iPaper Display',
	event_action: 'Button Click',
	event_label: 'Url: https://wwww.ipaper.io/',
	non_interaction: true,
	ip_url: 'https://wwww.ipaper.io/'
});
```

### Interactive flag <a href="#interactive-flag" id="interactive-flag"></a>

There are some events that we want to mark as non-interactive (or [“non-interaction events”](https://developers.google.com/analytics/devguides/collection/analyticsjs/events?hl=da#non-interaction_events) by Google Analytics’ definition). This will mean that even if these events are fired, the session will be considered as bounced if the user does not further interact with the page.

### Event labels

The data format below is represented in JSON. It is converted to a string for the `eventLabel` object using the following convention:

* Key names are PascalCased
* Key-value pairs are separated by the pipe character `|`

Example:

```json
{
  Id: [PRODUCT_ENTITY_PRODUCT_ID],
  Url: [PRODUCT_ENTITY_PRODUCT_URL]
}
```

…is converted into:

`Id: [PRODUCT_ENTITY_PRODUCT_ID] | Url: [PRODUCT_ENTITY_PRODUCT_URL]`


---

# 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://docs.ipaper.io/display-analytics/google-analytics.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.
