Jump to content

Where do I insert Google analytics code


Recommended Posts

Good morning all,

 

I have installed the google analytics module and entered the the tracking ID (UA-123456789-1) etc and now google is asking that I insert:

 

<script type="text/javascript">

 

var _gaq = _gaq || [];

_gaq.push(['_setAccount', 'UA-32158681-1']);

_gaq.push(['_trackPageview']);

 

(function() {

var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;

ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';

var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);

})();

 

</script>

 

into the head section.

 

Could someone tell me which file I need to open so as to insert this code.

 

I am using PS std theme 1.4.7.0

 

Hoping you can help

 

Paul

Link to comment
Share on other sites

 

I have installed the google analytics module and entered the the tracking ID (UA-123456789-1) etc and now google is asking that I insert:

 

Paul

 

Hi Paul, all you needed to do is insert your UA-xxx... in the google analytics module field. You would then not need to insert the code. If you navigate to your site and view any pages source code, you should see the UA- that you entered into the module.

  • Like 1
Link to comment
Share on other sites

  • 5 months later...

<!-- END BlockSTMenu --> <style>
  #page .leo-wrapper{ max-width:980px}
  </style><script type="text/javascript" src=""></script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '[color=#ff0000][b]UA-????????[/b][/color]']);
_gaq.push(['_trackPageview', '']);_gaq.push(['_trackPageLoadTime']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>

<body id="product">

 

It shows me code like this

Link to comment
Share on other sites

Go to your google analytic account, choose the account you want and go to admin. than you will see: Property ID: UA-XXXXXXX-X where xxxx should be numbers, after you get it, paste the ID to the google analytic module config in the back office.

Link to comment
Share on other sites

I have exactly the same problem. GA says "Status: Tracking Not Installed"

  • Prestashop V1.5.2
  • my domain: www.originalusb.com
  • UA-16887722-3
  • I tried also to uninstall and install ganalytics

 

I saw in firefox that UA is correct but GA says "Status: Tracking Not Installed"

Link to comment
Share on other sites

After you update your google account property ID (UA-XXXXXX-X) in the google analytic module / configure.

Go into your google analytic account, go to Admin -> choose the account you want -> choose the name under the properties -> choose the profile and in profile settings check the e-commerce tracking option (Yes, an E-Commerce site).

 

Also detailed information you can find in the module configure at back office.

Link to comment
Share on other sites

After you update your google account property ID (UA-XXXXXX-X) in the google analytic module / configure.

Go into your google analytic account, go to Admin -> choose the account you want -> choose the name under the properties -> choose the profile and in profile settings check the e-commerce tracking option (Yes, an E-Commerce site).

 

Also detailed information you can find in the module configure at back office.

 

it´s already made and it doesn´t works

Edited by originalusb (see edit history)
Link to comment
Share on other sites

  • 4 months later...

After you update your google account property ID (UA-XXXXXX-X) in the google analytic module / configure.

Go into your google analytic account, go to Admin -> choose the account you want -> choose the name under the properties -> choose the profile and in profile settings check the e-commerce tracking option (Yes, an E-Commerce site).

 

Also detailed information you can find in the module configure at back office.

 

I have exactly the same problem. GA says "Status: Tracking Not Installed"

  • Prestashop V1.5.2
  • my domain: www.originalusb.com
  • UA-16887722-3
  • I tried also to uninstall and install ganalytics

I saw in firefox that UA is correct but GA says "Status: Tracking Not Installed"

 

I have same problem. could someone help?

  • Prestashop version: 1.5.4
  • username: UA-39697324-1
  • my domain: ebisuya-tokyo.com
  • google analytics module version: 1.4.3
  • I tried also to uninstall and install ganalytics

Link to comment
Share on other sites

  • 1 month later...

Hi everyone, I'm facing the same problem. I'm installed:

- Prestashop 1.4.8

- Google Analytic module 1.4.1 by prestashop

 

I already insert the username UA-xxx and already disable cache and force compile to yes ..

But in the google analytic shown "status: tracking not installed" do I missed something here?

 

Update:

Sorry, I just checked on the google analytic pages, the data is arrive after 24 hours. but the status still same

"Status: Tracking Not Installed"

 

It's weird .. the status shown Tracking not installed, but the data arrive ...

I checked on the front-page - view source. the google ID : UA-xxx is correct.

Edited by Poring (see edit history)
Link to comment
Share on other sites

  • 5 months later...

It is quite normal.. i had the same experience..

 

give it a couple more day.. magically all the data should arrive and the status will change to RECEIVING DATA..

 

 

However it would be nice if someone can actually let us know where to paste the code manually?

 

for my experience prestashop Ganalytic module is not 100% bullet proof..

 

It kinda mess up with the goal setting in google analytic..

 

can somebody shed some light on this issue..

 

Thanks

Link to comment
Share on other sites

  • 1 month later...
Hi vekia,

 

Thanks for the information.

 

I would like to let a tip.

 

When I have put the Google Analytics tracking code between <head> and </head> tags of the header file, the store pages start appearing as empty pages.

 

I have found the answer for this problem in the link below.

 

Thanks.

 


  • Like 1
Link to comment
Share on other sites

 

When I have put the Google Analytics tracking code between <head> and </head> tags of the header file, the store pages start appearing as empty pages.

 

you probably forgot about {literal}{/literal} tags. when code use brackets (for example javascript) you have to use these tags.

{literal}
YOUR GOOGLE CODE HERE
{/literal}
  • Like 1
Link to comment
Share on other sites

  • 4 weeks later...
  • 2 months later...
  • 1 year later...

Hey, guys, I know this is an old topic, but I hope someone still looks at it. I have the same problem (google analytics showing status TACKING NOT INSTALLED even after 2 weeks of installing and configuring google analitics module on my prestashop). I tried inserting the tracking script into my header, just as explained above, but I get the following error message:

 

Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "/home/salus/public_html/themes/default_oszlopos/header.tpl" on line 66 "(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){" - Unexpected "[", expected one of: "}" , " " , ATTR' in /home/salus/public_html/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php:667 Stack trace: #0 /home/salus/public_html/tools/smarty/sysplugins/smarty_internal_templateparser.php(3144): Smarty_Internal_TemplateCompilerBase->trigger_template_error() #1 /home/salus/public_html/tools/smarty/sysplugins/smarty_internal_templateparser.php(3209): Smarty_Internal_Templateparser->yy_syntax_error(64, '[') #2 /home/salus/public_html/tools/smarty/sysplugins/smarty_internal_smartytemplatecompiler.php(105): Smarty_Internal_Templateparser->doParse(64, '[') #3 /home/salus/public_html/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php(206): Smarty_Internal_Smarty in/home/salus/public_html/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php on line 667

 

 

The google tracking code looks like this: 

<script>  (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');


  ga('create', 'UA-xxxxxx-x', 'auto');
  ga('send', 'pageview');


</script>

Of course I xxxxx-ed the tracing code. 

Any ideeas why it gives me this error?

 

 

BIG UPDATE: 

Sorry, my bad, I didnt read through the whole topic and forgot about the {literal}...{/literal} thing.

Why on earth dont they tell us about these things? :angry: 

What if there WOULD BE NO VEKIA TO TELL US? :D

 

Thanks, Vekia :)

Edited by Salus (see edit history)
Link to comment
Share on other sites

  • 1 year later...

One more thought: which one is the correct syntax: 

 

<script>

{literal}

(google function)

{/lieral}

</script>

 

OR

 

{literal}

<script>

(google function)

</script>

{/literal}

 

???

 

 

 

 

Open the.... themes/my_theme/header.tpl

Under the <head>

put this

 

<script> 

{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');
 
 
  ga('create', 'UA-xxxxxxx-x', 'auto');
  ga('send', 'pageview');
 
{/literal}
</script>
 
 
Before you replace the header.tpl from server i renamed to header-original.tpl 
and then i put the new one.
Edited by Athinodoros (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...