> For the complete documentation index, see [llms.txt](https://documentation.crossengage.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.crossengage.io/data-and-engagement-platform/messages/integrations/channels/webhooks/google-analytics-via-webhook.md).

# Google Analytics via Webhook

### Find your Google Measurement ID and API Secret

To configure Google Analytics 4 via Webhook, you will need your Google Measurement ID and API Secret. Note that the Measurement ID and the API Secret should be selected from the relevant data stream.

* Log in to [Google Analytics](https://analytics.google.com/).
* Click on Admin.
* Under 'Property', go to Data Streams.

<figure><img src="/files/3UL90mKmJEiMN4fdgfZD" alt=""><figcaption></figcaption></figure>

* Click on the Data Stream you wish to connect to CrossEngage.

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

* Copy your measurement ID. This will be needed in CrossEngage.

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

* Scroll down to events. Click on 'Measurement Protocol API Secrets".
* If you have not yet created an API Secret, create a new Secret.
* Copy your API Secret. This will be needed in CrossEngage.

<figure><img src="/files/5I3pca6YnZRVZkTEBgfu" alt=""><figcaption></figcaption></figure>

### Configure Google Analytics via Webhook

* In the CrossEngage app, navigate to `Settings` > `Integrations`.
* Click the `Add new integration` button in the top right corner of the page.

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

* Search for 'webhook'  and click **Set up.**

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

Using this information, you can now complete the setup form.

* Method: POST
* Destination URL: [https://www.google-analytics.com/mp/collect?measurement\_id=\<yourMeasurementId>\&api\_secret=\<yourAPISecret>](https://www.google-analytics.com/mp/collect?measurement_id=yourMeasurementId\&api_secret=yourAPISecret)
* Authentication: No authentication
* Content type: application/JSON

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

In the JSON text, paste the following JSON body:

```
{
    "client_id": "handlebar to fetch client id",
    "user_id": "handlebar to fetch user id",
    "events": [
        {
            "name": "event name",
            "params": {
                "param1": "xyz",
                "param2": "xyz"
            }
        }

]

}
```

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

* Click 'Apply'.

You can now use this integration in a campaign. When using the integration in a campaign, update the campaign message with the handlebars, event name, and parameters.&#x20;
