Usercentrics - PUBLIC

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

Configure Google Analytics 4 Measurement Id

  1. Open your Google Analytics account and navigate to Admin


  2. On the Admin Page, select Data Streams.

  3. In Data Stream, click 'Web' (if you're using Tag Manager on a webpage).

  4. Enter your page URL and name, then click Create Stream.

  5. After clicking Create Stream, a page with a Measurement ID will appear, which you can use in your Google Tag Manager account.

Configure Tag Manager

Create Google Analytics 4 tag

  1. On your Google Tag Manager, navigate to the 'Tags' tab and then click 'New' to proceed.

  2. Name the tag Google Analytics 4 tag, then click Tag Configuration and select Google Tag.

    Screenshot 2025-01-13 at 15.01.29.png
  3. Enter your Measurement ID in the "Tag ID" field (learn more here).

  4. Navigate to "Tag firing options" under "Advanced Settings" and select "Once per page".

    1. Explanation: If you want a certain technology to fire more than once per page view, you should set the tag firing option to "Unlimited". "Once per page", however, is Usercentrics' recommended setup.

  5. Save "Google Analytics 4 Tag".

    Screenshot 2025-01-13 at 15.09.30.png

Create Google Analytics 4 variable

To ensure that your non-IAB vendor scripts are not triggered without consent, follow these steps to create consent default status variables:

  1. Go to "Variables" in the side menu and select "User-Defined Variables," then click "New."

  2. Choose the variable type as "Data Layer Variable."

  3. Name the variable “Google Analytics 4 Variable” in the top-left field.

  4. For "Data Layer Variable Name," enter "Google Analytics 4" (exact spelling, capitalization, and hyphenation are required).

  5. Check the box for "Set Default Value" and set the default value to false.

  6. Save the "Google Analytics 4 Variable."

    Screenshot 2024-05-29 at 12.50.28.png

Create a Google Analytics 4 trigger

⚠️ Note: There are several ways to implement this logic. Usercentrics recommends the following option, however, depending on your setup, other structures might be more reasonable.

  1. Go to "Triggers" in the side menu and click "New."

  2. Choose "Custom Event" as the trigger type.

  3. In the top left, name the trigger "Google Analytics 4 Trigger."

  4. Check "Use regex matching" next to the "Event Name" field.

  5. In the "Event Name" field, enter consent_status.* ⚠️ Note: Ensure the spelling, hyphenation, and capitalization are exact.

  6. Select "Some Custom Events."

  7. In the condition settings, set: "Google Analytics 4 Variable" contains true. This ensures the trigger only fires if the user has opted in (variable=true).

  8. Save the trigger as "Google Analytics 4 Trigger."

    Screenshot 2025-01-13 at 15.25.24.png

    Finally, add the trigger to the "Google Analytics 4 Tag"

    Screenshot 2025-01-13 at 15.28.20.png
  • No labels