Additional Google Analytics JavaScript - Custom Dimensions 2022

Additional Google Analytics JavaScript - Custom Dimensions 2022

jordanbeacham
Tourist
3 0 2

I am trying to add a couple dimensions to be logged to Google Analytics. In the "Additional Google Analytics JavaScript" section within Preferences I am adding the below code. It is without a doubt not working. Neither dimension2 nor dimension1 are being logged at all. I have added the custom dimensions in the settings on the Google Analytics side. Is this functionality not working anymore in 2022? I noticed some articles about ga unable to be used as of mid 2021.

 

ga('set', 'dimension2','SomeTestValue');
var ua = navigator.userAgent;
ga('set', 'dimension1',(ua.indexOf("myapp") > -1) || (ua.indexOf("myapp") > -1) ? 'MyApp' : 'Other');

  

Replies 0 (0)