# Visualize Uniform data in GA4

> The integration with Google Analytics 4 enables you to see the performance data associated with experiences you created in Uniform Context.

Source: https://docs.uniform.app/docs/integrations/data/google-analytics/ga4-reports-personalization

Analytics platforms are the source of truth for many organizations and contain audiences, traits, KPIs, and other meaningful business data. Passing metadata about your personalized or A/B testing content back into that source of truth enables your analytics team to understand how content is resonating and inform decisions on whether targets for that type of content are being met, whether adjustments should be made to improve the content, or if further treatments to be added for under-performing segments.

## What data is passed from Uniform Context?

The integration with Google Analytics 4 enables you to see the performance data associated with experiences you created in Uniform Context.

This is done by passing an Events payload via a Google Analytics `Custom Event`.

### Personalization

The following code demonstrates how Uniform sends custom event data to GA4 to capture personalization activity:

```js
const personalizationMetadata = {
	"name": "Personalization Name",
	"variantIds": "Assigned Variation Name"
	"isControl": true | false,
	"changed": true | false,
}
//Google Analytics Custom Event
gtag('event', "Uniform Personalization", personalizationMetadata);
```

### A/B testing

The following code demonstrates how Uniform sends custom event data to GA4 to capture A/B testing activity:

```js
const testMetadata = {
	"name": "Experiment Name",
	"variantId": "Assigned Variation Name"
	"variantAssigned": true | false
}
//Google Analytics Custom Event 
gtag('event', "Uniform AB Testing", testMetadata);
```

## Validating the integration

To test that the integration is working, use the [GA Tag Debugger chrome extension](https://chrome.google.com/webstore/detail/google-analytics-debugger/jnkmfdileelhofjcijamephohjechhna?hl=en). This will enable you to check that the integration is firing as expected. The debugger will push events into the browser's JavaScript console for inspection.

Within your Google Analytics 4 property, there is also a "debug view" that allows you to see a real-time feed of events as they come into your property. The debug view can be reached from the main menu by navigating to **Configure > DebugView**.

![](https://docs.uniform.app/images/integrations/data/ga4/ga4-reports-personalization-debugview.png)

## Creating dimensions and audiences

A custom dimension in Google Analytics provides the ability to slice metrics data where the data is scoped appropriately.

An audience is a group of users that have any combination of similar attributes or traits. By grouping them together, we can understand patterns of behaviors.

> **Warning:**
>
> In the examples below, we're referring to "Uniform Personalization." The process is identical for your experiments; only you would use the Event Name: "Uniform AB Testing" instead.

### Create a custom dimension

1. Navigate to **Configure > Custom definitions**.
2. Click **Create custom dimensions**.
3. Enter the following values:

   | Field | Value | Notes |
   | --- | --- | --- |
   | Dimension name | `Uniform Personalization` | You can use any value you want here, but we recommend using the same name as the custom event. |
   | Scope | Event |  |
   | Description | Represents personalization activity captured by the Uniform tracker. | This is an optional value that can be helpful to other people in your organization who use Google Analytics. |
   | Event parameter | `variantIds` | This will enable you to filter and view each different treatment you have assigned for a specific piece of personalized content. |

   ![](https://docs.uniform.app/images/integrations/data/ga4/ga4-reports-personalization-customdimension.png)
4. Click **Save**.

> **Info:**
>
> This custom dimension can now be applied to your standard and
> free-form reports as either a dimension, comparison, or filter.

### Create an audience

1. Navigate to **Configure > Audiences**.
2. Click **New audience**.
3. Click **Create a custom audience**.

   ![](https://docs.uniform.app/images/integrations/data/ga4/ga4-reports-personalization-customaudience.png)
4. Enter a clear name and description.

   ![](https://docs.uniform.app/images/integrations/data/ga4/ga4-reports-personalization-audienceshape.png)
5. Select **Add new condition** and under "Events" look for and select the **Uniform Event Name** (typically: "Uniform Personalization").

   > **Info:**
   >
   > An event must have been collected by Google Analytics in order for
   > it to appear in this interface. In addition, data in GA4 can take
   > [24-48 hours to process and appear](https://support.google.com/analytics/answer/9333790?hl=en#:~:text=Many%20of%20your%20reports%20and,from%20your%20website%20or%20app) in
   > the reports UI.

   ![](https://docs.uniform.app/images/integrations/data/ga4/ga4-reports-personalization-audienceinfo.png)
6. Click **Add a Parameter > Custom > Uniform Personalization**.
7. Set the following values:

   | Field | Value |
   | --- | --- |
   | Condition | doesn't contain |
   | Value | `(not set)` |

   ![](https://docs.uniform.app/images/integrations/data/ga4/ga4-reports-personalization-doesnotcontain.png)
8. Click **Apply**.

> **Info:**
>
> Now you have your audience.

## Creating reports

Custom dimensions and Audiences can be used in similar ways
across Google Analytics, such as comparison segments, dimensions,
or filters for standard, out-of-the-box reporting or Google
Analytics 4 exploration reporting.

### Standard reports

You can use standard reports to determine the engagement rate
for your personalization variations.

1. Navigate to **Reports > Life cycle > Engagement > Pages and screens**.

   ![](https://docs.uniform.app/images/integrations/data/ga4/ga4-reports-personalization-pagesscreens.png)
2. At the bottom part of the screen, under the "Search..." box, click the  sign.

   ![](https://docs.uniform.app/images/integrations/data/ga4/ga4-reports-personalization-screens+dimensions.png)
3. Select your custom dimension.

   ![](https://docs.uniform.app/images/integrations/data/ga4/ga4-reports-personalization-varientID.png)

### Exploration reports

The free-form workbench provides a great deal of flexibility to enable you to look at your information from different points of view, making it easier to spot patterns within your data.

1. Navigate to **Explore**.
2. Click **Free-form**.

   ![](https://docs.uniform.app/images/integrations/data/ga4/ga4-reports-personalization-workbench.png)
3. Import the If you want to see the average engagement rate for the personalization
   treatments, you need to import the following variables:

   | Type | Value |
   | --- | --- |
   | Dimension | Uniform Personalization |
   | Metric | Average engagement time per session |

   > **Info:**
   >
   > Import the dimension or metric by using the  in the respective section.

   ![](https://docs.uniform.app/images/integrations/data/ga4/ga4-reports-personalization-importoptions.png)
4. Now add the data to the report by dragging it directly onto the
   body of the report or selecting it from the "Tab settings."

   > **Info:**
   >
   > The tab settings option provides greater control of the design
   > of the report and the order of your dimensions and metrics.

   ![](https://docs.uniform.app/images/integrations/data/ga4/ga4-reports-personalization-visualization.png)
