DocumentationMeasuring impactUsing a custom dimension with Google Analytics 4

Using a custom dimension with Google Analytics 4

NOTE: DataUnlocker can inject a custom dimension to proxied hits. However, because some (not very used) ad blockers block only third-party scripts requests (but allow pixels/hits), you may see a slightly lower number of "unblocked" users in a configured Google Analytics dimension than the real number of unblocked users.

Adding a custom dimension in Google Analytics 4 is very similar to adding a custom dimension to Universal Analytics properties, with just a few differences:

  • Adding a new custom dimension is located in "Events" left navigation menu
  • You can use any dimension name and specify any event parameter, not necessarily in the form "dimensionX". It can be just "dataunlocker", for example.

NOTE: if you haven't fully migrated to Google Analytics 4 yet, and is using Universal Analytics along with Google Analytics 4, you can keep the dimension name (event parameter name) in the format "dimensionX", as described in the guide above. Thus, the dimension will be compatible with both Universal Analytics and Google Analytics 4. Below, "dataunlocker" is used as a dimension name (event parameter name), but you can replace it with "dimensionX".

To create a new dimension in Google Analytics 4, navigate to the Events page, which can be accessed via the Events left navigation menu. Click on the "Create custom dimensions" button.

A list of custom dimensions in Google Analytics 4

In "Dimension name", input any human-readable name, which will be visible in the Google Analytics dashboards. For the Scope, select "Event". In the event parameter input, use the name of the dimension you specified in DataUnlocker (note that this value can only be in "dimensionX" format to be compatible with Universal Analytics).

Creating a new custom dimension in Google Analytics 4

In the example above, "dataunlocker" is used as a value of the event parameter name. Ensure that it is the same value you have specified in DataUnlocker, in the "custom dimension name":

A Google Analytics dimension name in DataUnlocker

Now, by analogy to how it works for universal analytics, add a segment matching your custom dimension to see distinguish unblocked users in your reports:

Adding a comparison view in Google Analytics 4

Select your custom dimension by name from the dropdown menu, and put "true" (or whatever you specified in DataUnlocker) as a value of "Dimension values".

Building comparison in Google Analytics 4

After some analytics is collected, you should see the comparison view of 2 segments: all users and unblocked users. Below is an example of how it will look like for Google Analytics 4 engagement overview.

Google Analytics 4 engagement overview for users with and without ad blocker installed

DataUnlocker Logo
DataUnlocker
Content blockers are friends