# Google Analytics 4 Proxy Advanced Tracking Configurations

By default, built in `page_view`, `scroll`, and `user_engagement` events will be sent to all configured measurement IDs in a given environment, for every page where the Freshpaint Autotrack snippet is loaded. This default behavior may not suit your use case. Freshpaint supports a number of alternate tracking configurations to ensure accurate measurement.

Here are some examples of advanced tracking configurations:

<table data-full-width="true"><thead><tr><th width="360">Use Case</th><th>Description</th></tr></thead><tbody><tr><td>Property per-domain</td><td><p>Track each domain in its own GA4 property. For example: </p><ul><li>GA4 property A measures only the traffic on mywebsite.com</li><li>GA4 property B measures only the traffic on yourwebsite.com</li></ul></td></tr><tr><td>Property per-subdomain</td><td><p>Track each subdomain in its own GA4 property. For example: </p><ul><li>GA4 property A measures only the traffic on www.mywebsite.com</li><li>GA4 property B measures only the traffic on app.mywebsite.com</li></ul></td></tr><tr><td>Property per-page or per URL path prefix</td><td><p>Divide the tracking for a domain or subdomain into multiple GA4 properties based on the page URL path or any other condition. For example: </p><ul><li>GA4 property A measures only the traffic on mywebsite.com/blog/...</li><li>GA4 property B measures only the traffic on mywebsite.com/careers/...</li></ul></td></tr><tr><td>Don't track certain pages</td><td>Prevent specified pages from tracking to GA4. For example, if GA4 property measures traffic on mywebsite.com, but mywebsite.com/login/... is a sensitive section of the site which should not be tracked to GA4.</td></tr></tbody></table>

## Caveats

* If you are using GA4 to measure a Single Page App (SPA), the GA4 property must measure all paths within the SPA. Measuring only certain paths within a SPA is not supported by Freshpaint and may result in misattributed traffic and significantly inaccurate event/session/user counts.

## How To Set Up Custom `page_view` Events

To achieve these advanced tracking configurations, you will need to follow the following steps for each GA4 property:

1. Create a GA4 Proxy Destination instance
2. Disable the built-in `page_view`event
3. Set up one or more custom `page_view`events

{% hint style="warning" %}
Incorrect configuration may result in misattributed traffic and significantly inaccurate event/session/user counts, so please be sure to follow the instructions carefully! Feel free to reach out to <support@freshpaint.io> for assistance.
{% endhint %}

### 1. Create a GA4 Proxy Destination Instance

Follow the instructions at [google-analytics-4-proxy-quick-start-guide](https://documentation.freshpaint.io/integrations/destinations/apps/google-analytics-4-proxy/google-analytics-4-proxy-quick-start-guide "mention") to create your GA4 proxy destination. If you already have a destination instance for this measurement ID, you can skip to the next step.&#x20;

### 2. Disable the built-in `page_view` event

Navigate to the Overview page and click Details for the GA4 destination.

<figure><img src="https://1666823438-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MA7aDqsXMFbUsWVqonF%2Fuploads%2FBwqtURdGFZwaCYHFe7tq%2Fga4proxy.png?alt=media&#x26;token=83a24cda-e08f-4b8a-a484-ea00e4c758ea" alt=""><figcaption></figcaption></figure>

Click Configure in the Base Configuration row.

<figure><img src="https://1666823438-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MA7aDqsXMFbUsWVqonF%2Fuploads%2FQ5HALuClKILpHt9ROIdg%2FScreenshot%202024-09-17%20at%201.49.37%E2%80%AFPM.png?alt=media&#x26;token=987e927d-9df5-44a5-b8ae-24379e6173f2" alt=""><figcaption></figcaption></figure>

Uncheck Send Page View Event and click "Save"

<figure><img src="https://1666823438-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MA7aDqsXMFbUsWVqonF%2Fuploads%2FVoPMvNahCGoo1hcbB1Es%2FScreenshot%202025-01-21%20at%2018.40.24.png?alt=media&#x26;token=d5d99b2c-6271-4ad4-9df1-98636a35c4b7" alt="" width="563"><figcaption></figcaption></figure>

### 3. Set up one or more custom `page_view`events

Custom `page_view`events depend on whether you manage event tracking in Google Tag Manager or in Freshpaint directly.

#### Instructions for Google Tag Manager

1. Import the Freshpaint tag template in Google Tag Manager. If you already have the Freshpaint tag template, you can skip this step. Otherwise, navigate to Templates, click "Search Gallery", and search for Freshpaint. Then, click "Add To Workspace".
2. Create your custom `page_view`tag. Navigate to "Tags", click "New", and select the "Freshpaint" template under "Custom".
   1. For tag type, select "Google Analytics 4 (Proxy)"
   2. Enter the measurement ID for your GA4 property. Do not enter more than one measurement ID; instead, you'll need to create a separate custom `page_view`event for each.
   3. For "Freshpaint Event Name", enter `page_view`.
   4. Use a "Page View"-type trigger for this tag to trigger on the pages you want to measure with this GA4 property.

<figure><img src="https://1666823438-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MA7aDqsXMFbUsWVqonF%2Fuploads%2FyDDb081aeTUty9wGiSNi%2FScreenshot%202025-01-21%20at%2019.08.56.png?alt=media&#x26;token=07168111-dcb4-406a-8d62-b8d2030dfb93" alt=""><figcaption></figcaption></figure>

3. Don't forget to "Publish" your changes!

#### Instructions for Freshpaint Event Library

1. Create a new event definition

   1. Navigate to the [Event Library](https://app.freshpaint.io/events/library) and click "+ Create Event".
   2. Give the event a meaningful name, such as "mywebsite.com/blog GA4 custom page\_view"
   3. For Library, choose "Web". For "Event Type", choose "Pageview". For URL Path, enter the path you would like to measure with this GA4 Property. To measure all pages, enter `*`.
   4. (Optional) Add any additional filters. For example if this GA4 property needs to measure traffic to only one domain, add a filter on "Domain".
   5. Click "Create Event".&#x20;

      <figure><img src="https://1666823438-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MA7aDqsXMFbUsWVqonF%2Fuploads%2FcEJxqXIXhBG056ADptFk%2FScreenshot%202025-01-21%20at%2019.48.55.png?alt=media&#x26;token=39dd0cdb-f298-4c40-8acb-77084f5e4845" alt=""><figcaption></figcaption></figure>
   6. Under "Event Destinations" turn on the destination for GA4 property you want to use to measure these pages. Do not turn on more than one destination; instead, you'll need to create a separate event definition for each destination.

   <figure><img src="https://1666823438-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MA7aDqsXMFbUsWVqonF%2Fuploads%2FlxOUnjloN9wyDBbKBVsi%2FScreenshot%202025-01-21%20at%2019.48.02.png?alt=media&#x26;token=0d880dd3-f8ad-4655-8e6b-4fc6282f4720" alt=""><figcaption></figcaption></figure>
2. Create a transformation to rename this event to `page_view`
   1. In Freshpaint, navigate to [Transformations](https://app.freshpaint.io/transformations)
   2. Click "+ Create New"
   3. Click "Modify Data"
   4. Choose your event definition's name from step 1b.
   5. Choose "Google Analytics 4 (Proxy)" for the destination.
   6. Click "Save & Add Transformation".&#x20;

      <figure><img src="https://1666823438-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MA7aDqsXMFbUsWVqonF%2Fuploads%2FEsOoDcw5j0Y7hzHoBYR9%2FScreenshot%202025-01-21%20at%2019.54.58.png?alt=media&#x26;token=48f63204-2e08-42fd-9aa5-73de4b9ff736" alt=""><figcaption></figcaption></figure>
   7. On the next screen, choose the "Rename Event" transformation and enter `page_view` for the event name. Click "Save".&#x20;

      <figure><img src="https://1666823438-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MA7aDqsXMFbUsWVqonF%2Fuploads%2FzkTVXyYjzoosyNZmYkh7%2FScreenshot%202025-01-21%20at%2019.58.20.png?alt=media&#x26;token=ffaa9d30-27fe-481f-82b6-acd74ee68c5f" alt=""><figcaption></figcaption></figure>
