Jump to content

[solved] Google Analytics not working?


Recommended Posts

I've turned on the ganalytics module and put in our UID. This was the same UID that we used on our previous site, which is collecting information fine.

 

With the module turned on, I can see that the analytics code is showing up in our pages, and is using the right UID.

 

But nothing seems to be getting collected when I log into analytics, it always shows zero hits.

 

Is there anything else I need to do to get this to work? Can I use a single GA UID for multiple domains like this?

Link to comment
Share on other sites

exactly, normal stats has got one day delay :-)

 

This is not exactly the case, if you are talking about the "Audience Overview" standard report of Google Analytics.

 

What is happening here is that, by default, the report shows data up to the previous day. You could always modify the date range to include the current day in the shown stats:

 

post-420007-0-17928300-1369950390_thumb.png

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

  • 8 months later...

Hi, im having alot of trouble with google analytics, ive installed the module, linked my account. Nothing. I have reinstalled the module, re-linked my account, still nothing, i have then manually place the code direct from google in several places still nothing, this has been going on for over 3 months. Please help

same here, for about a week now

Link to comment
Share on other sites

hello

please share url to your websites,

i will inspect these websites for google analytics code

 

are you sure that your analytics account are configured properly?

Hi there, the url of my website is

 

www.creative-art-supplies.co.uk

 

I certain it is configured, although I am new to this, I have read all the information. Could have missed something

Link to comment
Share on other sites

  • 11 months later...

SOLVED

 

The code you were seeing in the sourcecode was incorrect. Im not sure how this has happened, because the correct code was nothing like the one I had.

 

To solve the problem, I identified the location of the code which was recognised, and replaced it with the correct one. Problem solved

Hello.

 

Could you go into a little more detail on how you solved this? Right now my analytics is tracking everything but the home page.... I looked at the code, but it looks the same in the tracking and non-tracking pages

  • Like 1
Link to comment
Share on other sites

  • 4 months later...

I have a problem with the google analytics module. I've tried many versions of 2 modules but I can't seem to get ecommerce working - no orders are being tracked. I've tried 2.1.1. version - which tracks only visits on some pages. The downgraded 1.8 version tracks everything ok, except for the ecommerce - no orders are being tracked. I've also tried Universal analytics module, which mostly doesn't track ecommerce, and if it does, it multiplies every order by 2. Can anybody please help? I'm reallly desperate in search of a simple ecommerce tracking - just anyhow. My website is www.mujkoberec.cz. I would really appreciate if anyone could take a look at the problem. 

Link to comment
Share on other sites

I have a problem with the google analytics module. I've tried many versions of 2 modules but I can't seem to get ecommerce working - no orders are being tracked. I've tried 2.1.1. version - which tracks only visits on some pages. The downgraded 1.8 version tracks everything ok, except for the ecommerce - no orders are being tracked. I've also tried Universal analytics module, which mostly doesn't track ecommerce, and if it does, it multiplies every order by 2. Can anybody please help? I'm reallly desperate in search of a simple ecommerce tracking - just anyhow. My website is www.mujkoberec.cz. I would really appreciate if anyone could take a look at the problem. 

 

I''ve the same problem, since upgrade to 2.1.1 Google Analytics doesn't work anymore.

 

I toke a look of a lot forums but I haven't the solution yet :(

Link to comment
Share on other sites

  • 2 weeks later...

I solved my situation and It was really stupid thing  :blink:

 

I look in the history of changes of the administration in the View of my Google Analytics account... and I found there what cause my problem seeing the changes of the date when Analytics stop tracking. I added a filter for get only the visits of my IP when I wanted the opposite. I did it wrong.... I did this one day with a lot of other changes and I forgot about it....... :rolleyes:

 

Sometimes the stupid things happen

Link to comment
Share on other sites

  • 3 months later...

I have had same problem. And solved it.

Google analytics module had couple of errors in source code in modules/ganalytics/ganalytics.php

and it was generating incorrect code.

To fix it edit the file

go to line 259 and replace code with 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\', \''.Tools::safeOutput(Configuration::get('GA_ACCOUNT_ID')).'\', \'auto\');
ga(\'send\', \'pageview\');'
.(($user_id && !$back_office) ? 'ga(\'set\', \'&uid\', \''.$user_id.'\');': '')
.($back_office ? 'ga(\'set\', \'nonInteraction\', true);' : '')
.'</script>';
 
ORIGINALLY IT WAS:
<script type="text/javascript">
(window.gaDevIds=window.gaDevIds||[]).push(\'d6YPbH\');
(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\', \''.Tools::safeOutput(Configuration::get('GA_ACCOUNT_ID')).'\', \'auto\');
ga(\'require\', \'ec\');'
.(($user_id && !$back_office) ? 'ga(\'set\', \'&uid\', \''.$user_id.'\');': '')
.($back_office ? 'ga(\'set\', \'nonInteraction\', true);' : '')
.'</script>';
  • Like 5
Link to comment
Share on other sites

  • 2 months later...

We´ve just found a quick fix which works and we want to share it with you. Go to: 

 

/web/modules/ganalytics/ganalytics.php

 

and add this to line 344:

 

echo $this->hookHeader();

 

above:

$ga_scripts = '';

 

The function should look like this now: 

/**
	 * hook footer to load JS script for standards actions such as product clicks
	 */
	public function hookFooter()
	{
		echo $this->hookHeader();
		$ga_scripts = '';
		$this->js_state = 0;

		if (isset($this->context->cookie->ga_cart))
		{
			$this->filterable = 0;

			$gacarts = unserialize($this->context->cookie->ga_cart);
			foreach ($gacarts as $gacart)
			{
				if ($gacart['quantity'] > 0)
					$ga_scripts .= 'MBG.addToCart('.Tools::jsonEncode($gacart).');';
				elseif ($gacart['quantity'] < 0)
				{
					$gacart['quantity'] = abs($gacart['quantity']);
					$ga_scripts .= 'MBG.removeFromCart('.Tools::jsonEncode($gacart).');';
				}
			}
			unset($this->context->cookie->ga_cart);
		}

This calls up the function and includes all the script-data you need. Hope this helps, but be careful, when you update the module in future!

  • Like 1
Link to comment
Share on other sites

  • 7 months later...
  • 3 months later...

We´ve just found a quick fix which works and we want to share it with you. Go to: 

 

/web/modules/ganalytics/ganalytics.php

 

and add this to line 344:

 

echo $this->hookHeader();

 

above:

$ga_scripts = '';

 

The function should look like this now: 

/**
	 * hook footer to load JS script for standards actions such as product clicks
	 */
	public function hookFooter()
	{
		echo $this->hookHeader();
		$ga_scripts = '';
		$this->js_state = 0;

		if (isset($this->context->cookie->ga_cart))
		{
			$this->filterable = 0;

			$gacarts = unserialize($this->context->cookie->ga_cart);
			foreach ($gacarts as $gacart)
			{
				if ($gacart['quantity'] > 0)
					$ga_scripts .= 'MBG.addToCart('.Tools::jsonEncode($gacart).');';
				elseif ($gacart['quantity'] < 0)
				{
					$gacart['quantity'] = abs($gacart['quantity']);
					$ga_scripts .= 'MBG.removeFromCart('.Tools::jsonEncode($gacart).');';
				}
			}
			unset($this->context->cookie->ga_cart);
		}

This calls up the function and includes all the script-data you need. Hope this helps, but be careful, when you update the module in future!

That worked for me. Thanks!

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...
  • 2 weeks later...

Hey Everyone.

 

I have had similar issues with google analytics tag not showing since update, but seem to have found the problem (at least for my version):

 

Since the update there have been added the performance function: "Move javascript to the end"

The problem with this function, is that it moves the google analytics script to the end of the page. Google analytics tag needs to be in the <head></head> section of the website and not at the end. Disabling this function made google tag assistant register my analytics tag right away.

 

The function has created quite a few problems, and i therefore urge anyone who runs a small-medium webshop to disable it. I am not aware of the extra load time it might create on your site, but i am sure you can find out by yourself.

 

Thank you.

NBBO

Link to comment
Share on other sites

Ok. Apparently i was a bit too fast on the keyboard.

 

Disabling the "move javascript to the end" only fixed one of the problems, the HTTP response error still persisted.

But! The fix Bartek posted did actually fix the HTTP response error. Adding a HookHeader to the source code as Lucian writes, seem to make a double ga.js code in the header on my end, which might cause problems with the data (Send double data).

If you only use the fix posted by Bartek, google can find the tracking id but they write: "Tag found outside <head>" which also might cause problems. Therefore I will keep the "Move javascript to the end" disabled.

 

So in conclusion:

 

First use Barteks fix, and replace the source code around line 259 in ganalytics.php:

<script type="text/javascript">
(window.gaDevIds=window.gaDevIds||[]).push(\'d6YPbH\');
(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\', \''.Tools::safeOutput(Configuration::get('GA_ACCOUNT_ID')).'\', \'auto\');
ga(\'require\', \'ec\');'
.(($user_id && !$back_office) ? 'ga(\'set\', \'&uid\', \''.$user_id.'\');': '')
.($back_office ? 'ga(\'set\', \'nonInteraction\', true);' : '')
.'</script>';
 
With this code:
 
<script type="text/javascript">
(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\', \''.Tools::safeOutput(Configuration::get('GA_ACCOUNT_ID')).'\', \'auto\');
ga(\'send\', \'pageview\');'
.(($user_id && !$back_office) ? 'ga(\'set\', \'&uid\', \''.$user_id.'\');': '')
.($back_office ? 'ga(\'set\', \'nonInteraction\', true);' : '')
.'</script>';

 

Afterwards disable the performance option: "Move javascript to the end".

OR insert a HookHeader in ganalytics.php, like Lucian suggested (Warning: might cause double data).

 

Make google analytics search for the tracking ID again, and everything should work.

 

-NBBO

Link to comment
Share on other sites

×
×
  • Create New...