I am trying to get data from my Salesforce Communities (napili) into Google Analytics. This Google Analytics guide says this can be done using custom dimensions.
Custom dimensions and metrics allow you to combine Analytics data with non-Analytics data, e.g. CRM data
I tried to put the code that google analytics provides into a lightning component and put that component into the community.
ga('set', 'dimension3', 'custom data');
Error: ga is not defined
I set up google analytics in the community builder but I believe that locker service is blocking the component from accessing that ga object.
I also tried to manually load the google-analytics setup script into my component with ltng:require but even after uploading the js file as a static resource and setting up google-analytics as a CSP trusted site , the script is still throwing CSP errors.
If it is not possible to set custom dimensions, are there any an alternative strategy to get CRM data from salesforce into google-analytics