google-tag-managercustom-codegoogle-analytics-4

Can you create a custom dimension in GTM and send it to GA4 with custom code? Without having to manually create it inside GA4


I want to send different events tags to GA4 from GTM, and for every custom parameter used, I have to manually create it inside GA4 (to be available in the GA4 UI). Is there a way to custom code it in GTM and create it along with the tag?

Did not find anything that could help.


Solution

  • No, it's not possible to do it via GTM. Either you have to create it manually in GA4 UI or use the GA4 Admin API to create it programmatically.

    Alternatively, you may try Google Analytics Utilities to create custom dimensions/metrics using Google Sheets/Appscript.