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.
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).
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":
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:
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".
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.