Ghost Google Analytics Custom Dimensions

I have a Ghost Pro account hosting a newspaper style website. I’ve used google analytics and placed the tracking code via code injection, and this works great.

I’m trying to track authors via implementing custom gtag code to send the authors name along with the page view.

The google tutorials suggest using this code:

// Configures custom dimension<Index> to use the custom parameter
// 'dimension_name' for 'GA_TRACKING_ID', where <Index> is a number
// representing the index of the custom dimension.
gtag('config', 'GA_TRACKING_ID', {
'custom_map': {'dimension<Index>': 'dimension_name'}
});

// Sends the custom dimension to Google Analytics.
gtag('event', 'any_event_name', {'dimension_name': dimension_value});

What do I use for dimension value, the rest I understand, but when I try with ‘name’ as referenced in the post.hbs or author.name, the code doesn’t work. Has anyone else had success, do I need to place it directly in the hbs file instead of in code injection?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.