Lighthouse Steps
Go to https://app.getlighthouse.io/segments
- Allow Lighthouse to create a Custom Dimension in your Google Analytics account. Note that Custom Dimensions cannot be deleted in GA.
- Get the Custom Dimension index number in Google Analytics
- Log in to Google Analytics
- Go to Admin
- Under the Property column, click Custom Definitions then Custom Dimensions
- Find “LH_CLIENTID” and write down the corresponding index number
Google Tag Manager Steps
- Open GTM
- Tags > open GA tracking tag (requirement: GA must be deployed through GTM)
- Edit tag
- Add custom field
- Field name = customTask
- Value > hit plus icon in value field > create new > custom javascript >
- Name “Set Lighthouse Custom Dimension”
- Paste and replace the Custom Dimension index number
function() { // Modify "index_number" below to match the index number you want to send the data to var customDimensionIndex = index_number; return function(model) { model.set('dimension' + customDimensionIndex, model.get('clientId')); } }
9. Save
10. Preview
11. Submit
Note: that it could take a few hours for data to populate in GA