# Google Analytics

This guide provides a step-by-step process for setting up Google Analytics 4 (GA4) on your website, including how to integrate tracking in compliance with GDPR requirements. You'll learn how to create a GA4 property, find and use your Measurement ID, and configure your tracking code to activate only after user consent is given. This document also explains how GDPR compliance may impact data accuracy due to cookie consent restrictions.

For additional support, refer to these helpful resources:

* [How to find your Measurement ID](https://support.google.com/analytics/answer/12270356)
* [How to enable User ID tracking in GA4](https://support.google.com/analytics/answer/3123666)

## Setting Up Google Analytics 4 (GA4)

#### Step 1: Create a Google Analytics Account

1. Go to [Google Analytics](https://analytics.google.com/) and sign in with your Google account.
2. Click on **Admin** in the lower-left corner.
3. Under **Account**, select **Create Account** and follow the prompts to set up your account name and configure data sharing settings.

#### Step 2: Create a GA4 Property

1. After creating the account, click **Create Property**.
2. Enter the **property name**, select the **reporting time zone**, and **currency**.
3. Follow prompts to configure business details, then click **Create**.

#### Step 3: Get Your Measurement ID

1. In your GA4 property, go to **Data Streams** and select **Web**.
2. Enter your website URL and a stream name, then click **Create Stream**.
3. In the stream details, locate the **Measurement ID** at the top right (it starts with "G-").
4. Copy this Measurement ID — you’ll need it to set up tracking on your site.

#### Step 4: Add the Tracking Code with Cookie Consent Tag

1. Open **Wavecast Publishing** to your *Settings* > *Analytics* page.\ <br>

   <figure><img src="https://45522127-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FS512VHdqGC4MSzdDrKgr%2Fuploads%2F9DHVNCCzoc6XsPryPLkO%2FScreenshot%202024-11-05%20at%2010.28.38.png?alt=media&#x26;token=4f723ce3-11ea-4374-92eb-13c87e5f47fb" alt=""><figcaption></figcaption></figure>
2. Paste in the Measurement ID in the **Measurement ID** input field.<br>

   <figure><img src="https://45522127-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FS512VHdqGC4MSzdDrKgr%2Fuploads%2FzSbkoC9Z4UpYtPxALvFG%2FScreenshot%202024-11-05%20at%2010.29.57.png?alt=media&#x26;token=518f4cf3-674f-4c5a-9b4b-4fd2bf10f5fb" alt=""><figcaption></figcaption></figure>
3. In the `<head>` section of this page, paste the tracking code.
4. Modify the code by adding `data-cookieconsent="analytics"` to the script tag if you're using a cookie consent solution. The updated tag should look like this:<br>

   <figure><img src="https://45522127-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FS512VHdqGC4MSzdDrKgr%2Fuploads%2FiUxMyWgvPfYRZwu43Zvr%2FScreenshot%202024-11-05%20at%2010.26.30.png?alt=media&#x26;token=dca604e5-a99a-40e9-9688-6ad6b2fb26a1" alt=""><figcaption><p><strong>Note</strong>: Replace <code>YOUR_MEASUREMENT_ID</code> with the actual Measurement ID you copied in Step 3.</p></figcaption></figure>
5. Save and publish your changes.

***

### Enabling User-ID in Google Analytics 4

To accurately track user interactions across different devices and sessions, you can enable **User-ID** in Google Analytics 4. This feature allows you to gain deeper insights by associating multiple events and sessions with a unique, persistent ID for each user.\ <br>

<figure><img src="https://45522127-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FS512VHdqGC4MSzdDrKgr%2Fuploads%2FAF2WOt2BEnGf2Iiehzp3%2FScreenshot%202024-11-05%20at%2010.38.16.png?alt=media&#x26;token=46dd4f34-4312-4c3a-84c6-874b29640549" alt=""><figcaption></figcaption></figure>

\
**IMPORTANT**: Before implementing User-ID on your website, you **must first enable User-ID** in your GA4 account settings. Without enabling it, User-ID tracking will not function as intended.

***

### **Important: GDPR Compliance**

If you are implementing Google Analytics, you **must ensure compliance with EU GDPR laws**.&#x20;

This means that **you are required to implement a** [**cookie management solution**](https://docs.wavecast.io/analytics/cookie-management) to inform users and obtain their consent for data collection.

To comply:

* Use a cookie consent management tool that allows users to accept or reject cookies.
* Ensure that analytics tracking only activates after the user has given explicit consent.
* Clearly communicate in your privacy policy how Google Analytics is used and what data is collected.

Due to these regulations and the requirement for cookie consent, **your Google Analytics data may not be fully accurate**. Find out more about [types of cookie](https://docs.wavecast.io/cookie-management#types-of-cookies) and how [acceptance rates](https://docs.wavecast.io/cookie-management#acceptance-rates) affect website analytics.&#x20;

Note that the hub [dashboard](https://docs.wavecast.io/analytics/dashboard) provides some information about [page views](https://docs.wavecast.io/analytics/page-views) and [overall hub activity](https://docs.wavecast.io/analytics/dashboard). This is GDPR compliant, as rather than tracking the user, we are analysing the pages themselves instead and, where applicable, have anonymised the data.
