GA4 Custom Dimensions

Hello, I don’t find any informations on how to set custom dimensions via zaraz.

I have setup an split testing on my website, managed in PHP, and I want to set a custom dimension to filter users in Google Analytics.

I’ve read the doc about additionnal fields ( but I dont understand how it works. What should I put in the field?


How can I set a dimension value from a value in PHP at user level ?

I want something like this :

gtag('set', 'user_properties', {
  app_landing_version: '<?= $app_landing_version ?>'
1 Like

@user21240 Were you able to figure this out? I am researching using Zaraz as well to see if there are any major issues before implementing. It seems like you were looking for this similar function. zaraz.track() · Cloudflare Zaraz docs

zaraz.set · Cloudflare Zaraz docs is more appropriate for the requested usecase here. By setting the property, it will be sent along with subsequent zaraz.track() requests. That way you can access it via the client object to assign as part of whichever action properties you need, such as a custom dimension value.