bettabi Posted June 20, 2014 Share Posted June 20, 2014 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 More sharing options...
Michal_Ar Posted July 13, 2014 Share Posted July 13, 2014 (edited) 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 July 13, 2014 by Michal_Ar (see edit history) Link to comment Share on other sites More sharing options...
bettabi Posted July 14, 2014 Author Share Posted July 14, 2014 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 More sharing options...
Michal_Ar Posted July 14, 2014 Share Posted July 14, 2014 Can you share your site url? Link to comment Share on other sites More sharing options...
bettabi Posted July 14, 2014 Author Share Posted July 14, 2014 Yes, I'm working on this site: www.lesparigotes.com Link to comment Share on other sites More sharing options...
Michal_Ar Posted July 14, 2014 Share Posted July 14, 2014 I'd need your header.tpl fileI will send you my email to @bettabi.com Link to comment Share on other sites More sharing options...
Teddy's Dad Posted July 16, 2014 Share Posted July 16, 2014 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 More sharing options...
Michal_Ar Posted July 19, 2014 Share Posted July 19, 2014 Please share your url.Which header.tpl did you changed? The one in the Modules\ folder or the one in the Themes\? Link to comment Share on other sites More sharing options...
Gomlers Posted October 28, 2014 Share Posted October 28, 2014 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 More sharing options...
Antakarana Posted January 20, 2015 Share Posted January 20, 2015 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. What should I do next? Thanks in advance! Link to comment Share on other sites More sharing options...
Smiles Posted March 25, 2015 Share Posted March 25, 2015 Any news on this topic? I also posted this problem on https://www.prestashop.com/forums/topic/302640-google-analytics-16-problem/page-2 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now