Hello
In what file I have to put the code "google analytics" to track the homepage? I've added in the file "header.tpl" of the theme but does not work
Thanks
Regards
Printable View
Hello
In what file I have to put the code "google analytics" to track the homepage? I've added in the file "header.tpl" of the theme but does not work
Thanks
Regards
Hello Jose,
I have changed code a bit :) Please try to verify again.
Hello Viktor
It does not work. The code works on all pages except if I add in "header.tpl"
Thanks
Regards
Hello Jose,
Would you please send code to my PM.
it doesnt work for me neither
Hello Alexander,
What exactly doesn't work for you? Would you please explain us better.
it doesnt show the corrects numbers in analytics panel, where do i need to add the code?
Hello Alex,
You should choose alternative code and choose meta code. Then go to ftp://templates>>your_template>>tpl>>header.tpl and add meta code between tags <head></head>
save and check again in analytics.
Also js analytics code you should add with tags {literal}js analytics code{/literal}
Viktor write
Hello Alex,
You should choose alternative code and choose meta code. Then go to ftp://templates>>your_template>>tpl>>header.tpl and add meta code between tags <head></head>
save and check again in analytics.
the header.tpl has no tag <head> .... </head>
it has include file head.tpl
this is the start of file = header.tpl
{include file='head.tpl'}
<div class="main-wrapper">
<header class="page-header{if $pageInfo.Key == 'search_on_map'} fixed-menu{/if}">
<div class="point1 clearfix">
<div class="top-navigation">
<div class="point1">
{include file='blocks'|cat:$smarty.const.RL_DS|cat:'lang_se lector.tpl'}
I have added the code in file head.tpl (ftp://templates/your_template/tpl/head.tpl)
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-1660xxxxx-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-1660xxxxx-1');
</script>
I am waiting if it work or not
The code should be placed in head.tpl NOT header.tpl
tag <head> ....Google Code </head>
I have added the code in file head.tpl (ftp://templates>>your_template>>tpl>>head.tpl)
after the <head> tag
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
{literal}
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-1660xxxxx-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-1660xxxxx-1');
</script>
{/literal}
OK It's working fine