How to send Cookie Banner interaction events to Google Analytics 4

How enable use Google Analytics 4 tool?

Written by NelsonLast update 1 month ago

To enable Google Analytics 4, go to your CookieScript user account > Behavior > Frameworks, where you will find SEND EVENTS TO GOOGLE ANALYTICS 4:

Check the box if you want to enable use Google Analytics 4.

Additional actions if Google Analytics 4 is installed via Google Tag Manager.

If Google Analytics 4 is installed by placing Google Analytics 4 code on your website, no additional actions is needed. However, if your Google Analytics 4 is installed via a Google Tag Manager, there are some extra steps to connect your website events to Google Analytics 4 events:

Create 2 GTM variables:

  1. Go to your Workspace > Variables

  2. Create Content ID variable:

    Data Layer variable name: content_id

  3. Create Content type variable:

    Data Layer variable name: content_type

  4. Create a tag that will connect events from your Cookie Banner with your Google Analytics. Create a new Google Analytics: GA4 Event tag with the following config:

    Event name: select_content
    Event parameters: content_type and content_id
    Event parameters values: select variables that you just created.

  5. Set tag trigger like in the screenshot:

    Trigger type: Custom event
    Event name: select_content

All done. You can find more information on what events you will see in Google Analytics: guide on how to read Google Analytics statistics.

Enabling banner interaction statistics will not affect cookie compliance results.

Note: There are two methods to collect cookie banner analytics: using either CookieScript cookie banner analytics tool or Google Analytics 4. You could use CookieScript cookie banner analytics tool, Google Analytics, or both. See the guide on how to collect CookieScript cookie banner analytics.

Did this answer your question?