XF 2.2 Google analytics custom variables?


Active member
A fair while ago we lost our custom variables for Google Analytics and I cannot for the life of me find out how to re-add them.

I know where to add the property ID, it's all running fine on that front.

We used to have some good custom reports to track visits by forum ID and so on and I want to bring them back.

Can anyone point me in the right direction?

I can see in the page source where they should go but not in the Admin CP. Would we need to modify core templates?


Active member
Found the google analytics template easily enough:

<xf:if is="$xf.options.googleAnalyticsWebPropertyId">
    <script async src="https://www.googletagmanager.com/gtag/js?id={$xf.options.googleAnalyticsWebPropertyId}"></script>
        window.dataLayer = window.dataLayer || [];
        function gtag(){dataLayer.push(arguments);}
        gtag('js', new Date());
        gtag('config', '{$xf.options.googleAnalyticsWebPropertyId|escape("js")}', {
            // <!--[XF:ga:config_start]-->
            <xf:if is="$xf.cookie.domain">
                'cookie_domain': '{$xf.cookie.domain}',
            <xf:if is="$xf.options.googleAnalyticsAnonymize">
                'anonymize_ip': true,

Are there any existing addons or ways to add in our custom variables like ForumID?