# Google Analytics 4 Server-Side Quick Start Guide

{% hint style="info" %}
This destination uses the Google Analytics Measurement Protocol which provides a more limited API than a direct Google Analytics integration. Unless you want to send data to Google Analytics through the Freshpaint [HTTP API](/reference/developer/http-api.md) we recommend you use the [Google Analytics 4 Proxy](/integrations/destinations/apps/google-analytics-4-proxy.md) integration instead.
{% endhint %}

{% hint style="info" %}
If you have been running your analytics using Google Tag Manager, check out our [Google Tag Manager Integration](https://documentation.freshpaint.io/google-tag-manager-integration), in which the GTM native tag type is changed to a Freshpaint-template tag type. Freshpaint makes it easy to migrate all your tags from Google Tag Manager to the Freshpaint Google Tag Manage Template - you can learn more about this process [here](https://documentation.freshpaint.io/google-tag-manager-integration/migration).&#x20;

Contact <support@freshpaint.io> if you'd like to learn more.
{% endhint %}

If you are interested in migrating from native GA4 to running GA4 in Freshpaint, check out our [step by step migration guide](/reference/faqs/how-do-i-switch-from-native-google-analytics-to-the-freshpaint-google-analytics-destination.md).

Google Analytics 4 is an analytics service that enables you to measure traffic and engagement across your websites and apps. GA4 uses GA4 [**properties**](https://support.google.com/analytics/answer/9355666)**,** or sets of Google Analytics reports and data, which are designed for the future of measurement in the following ways:

* Collection of both website and app data to better understand the customer journey
* Use of events instead of session-based data
* Privacy controls are included such as cookie-less measurement, and behavioral and conversion modeling
* Predictive capabilities offer guidance without complex models

After sending Freshpaint data to Google Analytics 4, you'll be able to analyze the data in order to identify trends and patterns in how visitors engage with your website(s).

Learn more about Google Analytics 4 [here](https://support.google.com/analytics/answer/10089681).

## Destination Info

* Accepts [Track](https://documentation.freshpaint.io/developer/freshpaint-sdk-reference#track) calls
* Supports [HIPAA mode](https://documentation.freshpaint.io/hipaa-mode)
* Refer to this destination as **Google Analytics 4** in the [Integrations object](https://documentation.freshpaint.io/reference/developer/freshpaint-sdk-reference#using-the-integrations-object)
  * If you've configured multiple Measurement IDs, you can choose a specific one by suffixing the Measurement ID, such as: **Google Analytics 4::G-PSW1MY7HB4.** You can retrieve this value from the Google Analytics 4 (Server-Side) configuration page for the Measurement ID of interest. &#x20;

{% hint style="info" %}
When no suffix is specified, all configured Measurement IDs are selected for inclusion / exclusion.
{% endhint %}

* Connection Modes:

<table><thead><tr><th width="110"> </th><th data-type="checkbox">Client-side</th><th data-type="checkbox">Server-side</th></tr></thead><tbody><tr><td>Web</td><td>false</td><td>true</td></tr><tr><td>Mobile</td><td>false</td><td>true</td></tr><tr><td>Server</td><td>false</td><td>true</td></tr></tbody></table>

## Getting Started

To set up the GA4 (Google Analytics 4) integration, you need the following:

1. **Measurement ID:** You can find the measurement ID in the Google Analytics UI under: Admin > Data Streams > choose your stream > Measurement ID.
2. **API Secret:** An `API SECRET` is generated in the Google Analytics UI. To create a new secret, navigate to: Admin > Data Streams > choose your stream > Measurement Protocol > Create

<figure><img src="/files/E9Wsv72yEAStIwE7suru" alt=""><figcaption></figcaption></figure>

Next, go to the [Google Analytics 4 configuration page](https://app.freshpaint.io/destinations/apps/google-analytics-4) in Freshpaint and click Configure. Then, configure the app credentials by providing your Measurement ID and API Secret into Freshpaint.

That's it! Google Analytics 4 is now ready to be used as an event destination.

## Enable the GA4 Server Side Destination for Events

Once the GA4 integration [is enabled](https://documentation.freshpaint.io/readme/setting-up-your-destinations/enabling-and-disabling-a-destination), you can now set it as an event destination:

<figure><img src="/files/FTrEcsYW1qK2T320QguG" alt=""><figcaption></figcaption></figure>

If you've configured multiple Measurement IDs, you'll need to toggle each Measurement ID individually for each Freshpaint event.

If you're using Google Tag Manager to send data to Google Analytics 4, and you have multiple Measurement IDs enabled, you'll need to specify which Measurement ID(s) you'd like to enable the event for in the event tag.

### Confirm your events are sending as expected to Google Analytics 4&#x20;

Events sent from Freshpaint to GA4 will show up as standard GA4 events. From there you can use your events in any of the GA4 reports and use it to generate insights into your business.

The fastest way to confirm if the integration is working is to:

1. Send an event to GA4 via the toggle like in the screenshot above
2. Trigger the event you just toggled to send to GA4
3. Wait a few minutes, then check GA4's Realtime overview for the events. To navigate here, go to Reports > Realtime and scroll down to view the events:

<figure><img src="/files/yfCZ0WjXWcWUOPVT4FfR" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Data from the previous day may not be ingested and displayed by Google in Reports until 3:30pm ET the following day. Visit the Realtime overview in your Google Analytics account to get a quick view of the data captured within the last 30-minute window. &#x20;
{% endhint %}


---

# 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://documentation.freshpaint.io/integrations/destinations/apps/google-analytics-4/google-analytics-4-server-side-quick-start-guide.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.
