I was able to connect my UA Google Analytics to a new GA4 property via the admin panel of GA. Data began to flow into the new property without any code changes.
I have noticed that the custom dimensions are not populating however.
The js code in the page has a series of gtag set calls like the following:
gtag('set', 'dimension2', 'test')
I took a stab at configuring custom dimensions on the GA4 property to see if they would populate without code change. I went into the new GA4 property at Configure > Custom Definitions > Custom Dimensions and added several new custom dimensions with a User Property naming convention to match the legacy naming convention: dimension2, dimension3, etc.
So far this doesn't seem to have any impact. Is there a way to get the UA custom dimensions to flow into the GA4 property without modifying the javascript --or-- is there a way to write the javascript so that it is backwards compatible and posts the custom dimension to both my UA and GA4 properties?
Thanks
It should be
gtag('set', {'dimension2', 'test'})instead ofgtag('set', 'dimension2', 'test')