Jump to content

How to activate Analytics Demographic Reports


Recommended Posts

Hi!

 

I would like to activate Demographic Reports for my e-commerce, in order to gather more information about my customers.

 

To activate it in Analytics, Google says that I have to add a line of code: 

 

add "ga('require', 'displayfeatures');"

 

In my Analytics tracking code.

 

For embedding Analytics Code in my ecommerce I use the standard Google Analytics module (ganalytics) with Universal Analytics option activated.

 

Does anybody knows how to modify Google Analytics module to add code to activate Demographic Reports? 

 

Every workaround welcome :-)

 

Thanks for your answers!

 

 

Link to comment
Share on other sites

  • 4 weeks later...
Hi,
You can try the below.I'm also using the module and with Demographics. Go to Modules\ganalytics\views\templates\hook\ and edit header.tpl.

Find the code and put the piece in red.
 
script type="text/javascript">
    {if $universal_analytics eq true}
    {literal}
    (function (i, s, o, g, r, a, m) {
        i['GoogleAnalyticsObject'] = r;
        i[r] = i[r] || function () {
            (i[r].q = i[r].q || []).push(arguments)
        }, i[r].l = 1 * new Date();
        a = s.createElement(o),
                m = s.getElementsByTagName(o)[0];
        a.async = 1;
        a.src = g;
        m.parentNode.insertBefore(a, m)
    })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
    {/literal}
 
    ga('create', '{$ganalytics_id|escape:'htmlall':'UTF-8'}'{if isset($pageTrack)}, '{$pageTrack|escape:'htmlall':'UTF-8'}'{/if});
 
    {if $isOrder eq true}
    ga('require', 'ecommerce', 'ecommerce.js');
    {else}
    ga('send', 'pageview');
    ga('require', 'displayfeatures');
    ga('require', 'linkid', 'linkid.js');
    {/if}
Edited by Michal_Ar (see edit history)
Link to comment
Share on other sites

Hi and thanks for your reply!

 

I've tried to modify Modules\ganalytics\views\templates\hook\header.tpl but my file is a bit different from yours... It looks like this:

 

 

<script type="text/javascript">
    {if $universal_analytics eq true}
    {literal}
    (function (i, s, o, g, r, a, m) {
        i['GoogleAnalyticsObject'] = r;
        i[r] = i[r] || function () {
            (i[r].q = i[r].q || []).push(arguments)
        }, i[r].l = 1 * new Date();
        a = s.createElement(o),
                m = s.getElementsByTagName(o)[0];
        a.async = 1;
        a.src = g;
        m.parentNode.insertBefore(a, m)
    })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
    {/literal}
 
    ga('create', '{$ganalytics_id|escape:'htmlall':'UTF-8'}'{if isset($pageTrack)}, '{$pageTrack|escape:'htmlall':'UTF-8'}'{/if});
 
    {if $isOrder eq true}
    ga('require', 'ecommerce', 'ecommerce.js');
    {else}
    ga('send', 'pageview');
    {/if}

 

 

I've added:

ga('require', 'displayfeatures');

after:

ga('send', 'pageview');

 

But when I try to validate tracking gode in Analytics it says that the traking code is not ok.

 

What can I do?!

 

Thanks!

Link to comment
Share on other sites

Hi guys

 

Did you manage to solve this problem? I am in a similar position  where I have added the line of code to my header.tpl. I can see it appearing on the pages when looking at the page source, but I still cannot validate this through GA.

 

Any ideas would be greatly appreciated

 

Best wishes

 

Calvin

Link to comment
Share on other sites

  • 3 months later...

Hi and thanks for your reply!

 

I've tried to modify Modules\ganalytics\views\templates\hook\header.tpl but my file is a bit different from yours... It looks like this:

 

 

<script type="text/javascript">
    {if $universal_analytics eq true}
    {literal}
    (function (i, s, o, g, r, a, m) {
        i['GoogleAnalyticsObject'] = r;
        i[r] = i[r] || function () {
            (i[r].q = i[r].q || []).push(arguments)
        }, i[r].l = 1 * new Date();
        a = s.createElement(o),
                m = s.getElementsByTagName(o)[0];
        a.async = 1;
        a.src = g;
        m.parentNode.insertBefore(a, m)
    })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
    {/literal}
 
    ga('create', '{$ganalytics_id|escape:'htmlall':'UTF-8'}'{if isset($pageTrack)}, '{$pageTrack|escape:'htmlall':'UTF-8'}'{/if});
 
    {if $isOrder eq true}
    ga('require', 'ecommerce', 'ecommerce.js');
    {else}
    ga('send', 'pageview');
    {/if}

 

 

I've added:

ga('require', 'displayfeatures');

after:

ga('send', 'pageview');

 

But when I try to validate tracking gode in Analytics it says that the traking code is not ok.

 

What can I do?!

 

Thanks!

 

I'm having the exact same problem as you, with the exact same ga-code in the header.tpl of the catalog for ganalytics.

Did you make this work,  if so - how? :)

Link to comment
Share on other sites

  • 2 months later...

Hi and thanks for your reply!

 

I've tried to modify Modules\ganalytics\views\templates\hook\header.tpl but my file is a bit different from yours... It looks like this:

 

 

<script type="text/javascript">
    {if $universal_analytics eq true}
    {literal}
    (function (i, s, o, g, r, a, m) {
        i['GoogleAnalyticsObject'] = r;
        i[r] = i[r] || function () {
            (i[r].q = i[r].q || []).push(arguments)
        }, i[r].l = 1 * new Date();
        a = s.createElement(o),
                m = s.getElementsByTagName(o)[0];
        a.async = 1;
        a.src = g;
        m.parentNode.insertBefore(a, m)
    })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
    {/literal}
 
    ga('create', '{$ganalytics_id|escape:'htmlall':'UTF-8'}'{if isset($pageTrack)}, '{$pageTrack|escape:'htmlall':'UTF-8'}'{/if});
 
    {if $isOrder eq true}
    ga('require', 'ecommerce', 'ecommerce.js');
    {else}
    ga('send', 'pageview');
    {/if}

 

 

I've added:

ga('require', 'displayfeatures');

after:

ga('send', 'pageview');

 

But when I try to validate tracking gode in Analytics it says that the traking code is not ok.

 

What can I do?!

 

Thanks!

 

Hi,

 

I've did the same that I remark in red....

 

Then I went to analytics panel and I clicked on "validate tracking code", however it does nothing, I just remain in the same page... So I'm not sure if the next step should be "omit the validation process" or if I must modify something else on the code.

 

thump_9247239validate.png

 

What should I do next? :unsure:

 

Thanks in advance!

Link to comment
Share on other sites

  • 2 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...