# Edge segments

## How it works

You can **compute segments browser-side** using our **Edge technology** and share them with Google Ad Manager. This allows you to react instantly to user behavior and trigger campaigns as users navigate your website.

To do so, the mediarithmics tag:

* **Collects and stores identifiers and navigation data in local storage**. When an event is pushed by the tag, it is sent both to the activity processing pipeline and saved locally.
* **Computes browser-side which segments the user enters or leaves**.
* When a user enters or exits one or more segments:
  * **Triggers the Google Ad Manager integration**
  * **Sends the information back to the server to maintain a server-side state of the segment**. Segment statistics are computed periodically by running a query that counts users flagged as belonging to the segment.

{% hint style="info" %}
Only users who navigated your site with the Edge feature activated will be in the segment.
{% endhint %}

## Setup

To configure the Edge segmentation feature, please follow the steps outlined below.

#### 1. Prerequisites

* **Update Snippet**: Ensure your site is running the latest version of the mediarithmics snippet. (Refer to [Website tracking](https://developer.mediarithmics.io/data-streams/data-ingestion/real-time-user-tracking/web-events#implementing-the-snippet) documentation for details).
* **Feature Activation**: Contact your Account Manager to enable Edge on your specific channels.

#### 2. Schema Configuration

Identify the properties in your schema required for Edge-based user segmentation and mark them with the `@EdgeAvailability` flag (see [Data model @EdgeAvailability directives](https://developer.mediarithmics.io/schema#edgeavailability) for more information)

Note that you must meet the following requirements:

* **Supported Objects**: Edge only supports properties from the following objects:
  * `UserDeviceTechnicalId`
  * `DeviceInfo`
  * `UserSegment`
  * `UserEvent` (including all sub-object properties)
* **Data Integrity**: Properties must exist in the schema and be stored exactly as pushed by the tag. No transformations (e.g., event rules or visit analyzers) can be applied.
* **Directives**: A property using the `@PropertyPath` directive is only compatible if the path name and property name are identical in both the schema and the data layer.

{% hint style="info" %}
**Tip:** We recommend validating your schema changes with our technical team before deployment.
{% endhint %}

#### 3. SSP / AdServer Integration

Finalize the connection between mediarithmics and your delivery platforms.

* Google Ad Manager (GAM): The JS snippet automatically pushes segment IDs as key-values to the ad call. However, these must be manually created within the GAM UI.
  * *Reference:* [GAM Key-Value Setup Guide](https://support.google.com/admanager/answer/9796369?hl=en)
* Other Platforms: While there is no native "out-of-the-box" integration for other platforms yet, it can be implemented easily on your side, as segment IDs are stored and available in Local Storage.
