Post by steveharman » Thu Mar 15, 2012 4:38 am

Hi!

I just pasted my Google Analytics tracking code into System > Settings > [my store] > Server > 'Google Analytics Code:' box and the tracking code is showing up on my store's home page. i.e; visible to users.

In fact it's on every page at the very top left of the screen. I'm using the default unmodified template on a totally fresh install.

Bug? Or me? ;-)

Thanks,

Steve

Active Member

Posts

Joined
Mon Mar 12, 2012 6:36 pm

Post by Johnathan » Thu Mar 15, 2012 5:16 am

Just you. :) Make sure you're including the <script> tags that surround the code.

Image
Image Image Image Image


User avatar
Global Moderator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by Daniel » Thu Mar 15, 2012 3:48 pm

steveharman wrote:Hi!

I just pasted my Google Analytics tracking code into System > Settings > [my store] > Server > 'Google Analytics Code:' box and the tracking code is showing up on my store's home page. i.e; visible to users.

In fact it's on every page at the very top left of the screen. I'm using the default unmodified template on a totally fresh install.

Bug? Or me? ;-)

Thanks,

Steve

you!

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by steveharman » Thu Mar 15, 2012 5:13 pm

You are both correct! ;-) And thanks it's working fine now.

In fairness though; bit ambiguous in the admin page, code or code?

System > Settings > Server > Google Analytics Code box says, and I quote, "Login to your Google Analytics account and after creating your web site profile copy and paste the analytics code into this field." Fine so my analytics code is UA-xxxyyz44-1 and away I go. Perhaps like many others I suspect, I'd assumed OpenCart had the JavaScript in place which it wrapped around my UA-xxxyyzz "analytics code" that I put in the appropriate box.

No big deal, just a slight usability clarification for future users perhaps?

Thanks again folks.

Steve

Active Member

Posts

Joined
Mon Mar 12, 2012 6:36 pm

Post by mavibrick » Thu Mar 15, 2012 7:37 pm

steveharman wrote:You are both correct! ;-) And thanks it's working fine now.

In fairness though; bit ambiguous in the admin page, code or code?

System > Settings > Server > Google Analytics Code box says, and I quote, "Login to your Google Analytics account and after creating your web site profile copy and paste the analytics code into this field." Fine so my analytics code is UA-xxxyyz44-1 and away I go. Perhaps like many others I suspect, I'd assumed OpenCart had the JavaScript in place which it wrapped around my UA-xxxyyzz "analytics code" that I put in the appropriate box.

No big deal, just a slight usability clarification for future users perhaps?

Thanks again folks.

Steve
Hi I'am sorry but i couldn't manage it. How did you solve this problem. What do you guys mean with script surrounding the code? please help. Can't get this work out.

Newbie

Posts

Joined
Thu Mar 15, 2012 7:35 pm

Post by steveharman » Thu Mar 15, 2012 8:16 pm

Hi!

At the section of Google's Analytics site ('Admin') which displays your unique tracking code (usually begins with UA....), there should also be a chunk of HTML / JavaScript code shown at the bottom of the page. It'll be something like this:

Code: Select all

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-xxxxxxxxx-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>
Notice your own tracking code will be shown where my example has UA-xxxxxxxx. Copy and paste that entire block of code from Google's site and put that into OpenCart at System > Settings > [your site] > Server > 'Google Analytics Code:' (scroll to bottom of page).

That's where I fell down, OpenCart asks for 'Google Analytics Code' and I gave it... my Google Analytics code! What OpenCart actually needed was the Analytics code and all the supporting JavaScript etc.

Seems to work fine now.

HTH

Steve

Active Member

Posts

Joined
Mon Mar 12, 2012 6:36 pm

Post by mavibrick » Thu Mar 15, 2012 8:57 pm

Hi Steve,

Now it's clear. Thank you very much for your help.

Mavi

Newbie

Posts

Joined
Thu Mar 15, 2012 7:35 pm

Post by gail315 » Tue May 08, 2012 6:53 am

What if you have multiple stores? Each domain has a different Google Analytics Code . How do you give each store the correct Google Analytics Code ? ???

New member

Posts

Joined
Wed Apr 25, 2012 8:25 am

Post by kimsonvu » Mon May 21, 2012 6:30 pm

I have same question with gail315!

New member

Posts

Joined
Tue Feb 22, 2011 8:29 pm

Post by lperagallo » Mon Nov 12, 2012 10:10 am

Has anyone figured out how to get Google analytics code set up for multiple stores? I have two stores configured and two unique codes from google, but I have no idea how to set this up to work and can't find a post any where about it.

Lou

New member

Posts

Joined
Sun Oct 30, 2011 12:05 pm

Post by lperagallo » Mon Nov 12, 2012 10:23 am

OK,

I put the code below and google keeps reporting:

Tracking ID

UA-36229666-1


Status: Tracking Not Installed.

Any idea how to fix this?

Code is in the box in SYSTEM, SETTINGS, Hobby-drones store, SERVER tab:

<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-36229666-1']);
_gaq.push(['_setDomainName', 'hobby-drones.com']);
_gaq.push(['_setAllowLinker', true]);
_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>

New member

Posts

Joined
Sun Oct 30, 2011 12:05 pm

Post by gail315 » Tue Nov 13, 2012 12:55 am

Lou...

I am using this FREE extension 8) for the Multistore Google Anayltics:
http://www.opencart.com/index.php?route ... on_id=6571

Gail

New member

Posts

Joined
Wed Apr 25, 2012 8:25 am

Post by sambick2 » Thu Jan 03, 2013 5:59 pm

lperagallo wrote:OK,

I put the code below and google keeps reporting:

Tracking ID

UA-36229666-1


Status: Tracking Not Installed.

Any idea how to fix this?

Code is in the box in SYSTEM, SETTINGS, Hobby-drones store, SERVER tab:

<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-36229666-1']);
_gaq.push(['_setDomainName', 'hobby-drones.com']);
_gaq.push(['_setAllowLinker', true]);
_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>
Ok, go via ftp to the catalog-view-theme-your_theme-template-common folder. Find header.tpl file. Backup it. Open it and find <body>. Below this paste a code from google analytic like:

Code: Select all

<script type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-xxxxxxx-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>
Save the header.tpl . Check your google analytic on http://www.google.com/analytics/

Newbie

Posts

Joined
Sun Oct 14, 2012 5:17 am

Post by alexascj » Thu Apr 04, 2013 7:06 pm

Hello,

please help me too:D I`ve put the code in the space dedicated in system not working, i`ve put the code in the script head and footer...still not working. Ideas?

Newbie

Posts

Joined
Thu Apr 04, 2013 6:24 pm

Post by jbcul » Tue Apr 09, 2013 12:59 am

Good Posting. I too slammed in my code thinking "code" meant the number UA - xxxxxxxx-x only to read this post and realize that code meant the full tracking code. Thanks much. Our store has not gone live yet so I can't test much but it appears to be working.

New member

Posts

Joined
Fri Feb 01, 2013 9:18 am

Post by atzi » Sat Nov 09, 2013 9:52 am

Great post. Wish we could rate forum posts, I would rate this a very helpful.

Newbie

Posts

Joined
Sat May 12, 2012 11:28 pm

Post by sml » Sun Dec 22, 2013 7:09 pm

Same confusion for me also ... I thought that the Google Analytics code was just the UAxxxxx code.

sml
Active Member

Posts

Joined
Sat Apr 02, 2011 6:56 am

Post by labeshops » Sun Dec 22, 2013 9:30 pm

Just an fyi - you can put any code you need to add to the header in this box, not just google analytics. I'm using the multistore mod now and can add my alexa, yahoo shopping, and other verification code lines (the complete < code > ) into the box along with the Google Analytics one easily for any store at any time. Very helpful.

Running Opencart v2.2 with multi-stores from http://www.labeshops.com which has links to all my stores.

Image


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by Dhaupin » Wed Nov 12, 2014 12:35 am

labeshops wrote:Just an fyi - you can put any code you need to add to the header in this box, not just google analytics. I'm using the multistore mod now and can add my alexa, yahoo shopping, and other verification code lines (the complete < code > ) into the box along with the Google Analytics one easily for any store at any time. Very helpful.
You shouldn't use the analytics code box for anything besides Google analytics. Other mods use it like an object sometimes. For example ecommerce tracking takes it out of header and puts before foot on order complete page. If you had other mods in the box that depended on closing head location, they might wonk out.

I realize this is a way old thread, but its coming up for searches. We made a free mod to help with this stuff regarding more code boxes and multi-store compatibility. Should help solve some of this and extend code boxes for things like live chat, otmizely, tag manager, etc: http://www.opencart.com/index.php?route ... n_id=19485

https://creadev.org | support@creadev.org - Opencart Extensions, Integrations, & Development. Made in the USA.


User avatar
Active Member

Posts

Joined
Tue May 13, 2014 3:45 am
Location - PA

Post by mtjhost » Sun Jan 31, 2016 7:20 pm

Hi I unable to Find the Google analytic tracking option in server. Is there something wrong with my installation? Its 2.1.0.2 Install.

Where I should rectify the same.

New member

Posts

Joined
Wed Apr 30, 2014 12:37 am
Who is online

Users browsing this forum: No registered users and 10 guests