Learn business growth with Google Analytics 4 › Forums › Google Analytics 4 › 'GA4 Custom Dimensions Not Working Properly' › Reply To: 'GA4 Custom Dimensions Not Working Properly'
-
Based on your code, it seems you’ve done everything correctly. However, there is a chance you might be running into a race condition issue where the data is not fully registered before the page view event is sent.
In order to debug this, I would suggest checking how you are setting your custom dimensions. Make sure you are using the correct dimension names in your GA4 configuration. You could also verify whether you have correctly set up your GA4 Custom Dimensions config tag in GTM and that the triggering occurs at the right time.
Additionally, check if your dataLayer.push is executing before the GTM event trigger fires. If your dataLayer.push executes after the GTM event trigger, the data may not be included in the event.
Lastly, check your GTM to GA4 data mapping. Ensure that you are mapping from the correctly named variables, and that ‘article_id’, ‘type’, ‘category’, ‘subcat’, ‘pubdate’, match exactly to your custom dimensions in GA4.
Remember, the debugging process may take some time and require a lot of testing to make sure everything is set up correctly.