Banner Statistics – enable stats and configure Google Analytics 4

Questions the banner statistics can answer

  • How often was the the banner clicked?
  • What consent was given, when clicked?
  • How often opened banner before clicking?
  • How often consent was not granted?
  • How often consent was granted?

What data is stored?

You can store the data in two different ways. It can be easily configured in the plugin settings area.

Google Analytics 4

The banner uses google analytics 4 to collect the banner statistics. Only the following data is sent to GA4:

  • the consent settings: type and if enabled or not
  • the type of button clicked: dismiss / accept /accept all
  • the current page url
  • the referrer of the page where the banner has opened or clicked
  • how often the banner has already opened for the user. (if feature is enabled, it is stored in localStorage)

There is NO hit sent from the browser to google analytics! The data is sent to google analytics server2server.

Local Logfiles

The same data as for google analytics 4, and additionally:

  • Users IP Adress
  • the current timestamp
1. Go to statistics settings and enable the module

Please make sure you have installed at least version 2.7.1 of the main plugin.

2. Get your Google Analytics Measurement Id

Please create a new property which you only use for the banner statistics. Otherwise it will mess up your metrics.

Create a new web stream and retrieve the measurement id from it:

3. Create your measurement protocol secret

You can do that in your web stream details as well.

4. Add the Measurement ID and the API secret to the plugin settings
5. Add custom event parameter as custom dimension to GA4

In google analytics 4 click on the left pane “Configure” and then “Custom definitions”

Now click on “Create custom dimension”.

Create four new custom dimensions for these “Event parameter”:

  • banner_open_count
  • page_location
  • page_referrer
  • page_title

Make sure the scope is “Event” and you choose the correct “Event parameter”. For “Dimension name” and “Description” you can choose whatever you like.

6. Finish. Now you can see the banner click events in Google Analytics.

Want to see the banner opens? And how often the banner opened, before the user has clicked it? For that you can enable “Banner open counter” and “Send open event”

Configure cookie banner statistics module for local logs

If you want to store the banner interactions in a local log file you can do so. Please be aware that wordpress needs direct access to the filesystem for that feature.

To enable it just tick these boxes:

If you do not add a measurement id the data is only stored locally.

You can access the data in this path: /wp-content/nsc-bara-beautiful-cookie-banner-addon-files/consent-logs/.

The data is stored as ndjson.