Google Analytics conflict
13 years 5 months ago #105833
by sambob
Don't look at what is and ask 'why?'; look at what isn't and ask 'Why Not!'
Google Analytics conflict was created by sambob
Hi,
I am have some issues with inconsistent Google Analytics recoding of transactions. Soe are missed and some have the totals doubling.
After about 4 weeks pushing Google on it, they have analysed what they perceive as the issue.
1) I am using the Hikashop plugin as well as the GA code added to the template, and this is creating code duplication where the plugin is adding the code.
Any thoughts on how to stop the general site code from plugin one?
2) There is another error as there is a comma behind the last Tran parameter country:
'Australia', // country
but it should look like this:
'Australia' // country
Ant thoughts on solving these.
I am have some issues with inconsistent Google Analytics recoding of transactions. Soe are missed and some have the totals doubling.
After about 4 weeks pushing Google on it, they have analysed what they perceive as the issue.
1) I am using the Hikashop plugin as well as the GA code added to the template, and this is creating code duplication where the plugin is adding the code.
Any thoughts on how to stop the general site code from plugin one?
2) There is another error as there is a comma behind the last Tran parameter country:
'Australia', // country
but it should look like this:
'Australia' // country
This attachment is hidden for guests.
Please log in or register to see it.
Please log in or register to see it.
Ant thoughts on solving these.
Don't look at what is and ask 'why?'; look at what isn't and ask 'Why Not!'
Please Log in or Create an account to join the conversation.
13 years 5 months ago #105948
by nicolas
Replied by nicolas on topic Google Analytics conflict
Hi,
For the country it's easy, just change the line:
to:
in the file plugins/system/hikashopanalytics.php
For the GA code in the template, what is the exact code that you added in your template ?
For the country it's easy, just change the line:
Code:
'".str_replace("'",'\\\'',@$order->billing_address->address_country)."', // country
to:
Code:
'".str_replace("'",'\\\'',@$order->billing_address->address_country)."' // country
in the file plugins/system/hikashopanalytics.php
For the GA code in the template, what is the exact code that you added in your template ?
Please Log in or Create an account to join the conversation.
13 years 5 months ago #106011
by sambob
Don't look at what is and ask 'why?'; look at what isn't and ask 'Why Not!'
Replied by sambob on topic Google Analytics conflict
Hi Nicolas,
thanks you your reply.
The code I have (template.php) is:
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push();
_gaq.push();
(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>
thanks you your reply.
The code I have (template.php) is:
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push();
_gaq.push();
(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>
Don't look at what is and ask 'why?'; look at what isn't and ask 'Why Not!'
Please Log in or Create an account to join the conversation.
13 years 5 months ago #106086
by nicolas
Replied by nicolas on topic Google Analytics conflict
Hi,
Add the line:
before:
in the file plugins/system/hikashopanalytics.php and that should remove the code duplication.
Add the line:
Code:
$body = preg_replace("#<script type=\"text/javascript\">.*'https://ssl' : 'http://www') + '\.google-analytics.com.*</script>#siU",'',$body);
before:
Code:
$body=str_replace('</head>', $js.'</head>', $body);
in the file plugins/system/hikashopanalytics.php and that should remove the code duplication.
The following user(s) said Thank You: sambob
Please Log in or Create an account to join the conversation.
13 years 5 months ago #106155
by sambob
Don't look at what is and ask 'why?'; look at what isn't and ask 'Why Not!'
Replied by sambob on topic Google Analytics conflict
Thanks nicolas,
Greatly appreciated.
Greatly appreciated.
Don't look at what is and ask 'why?'; look at what isn't and ask 'Why Not!'
Please Log in or Create an account to join the conversation.
13 years 5 months ago #106248
by sambob
Don't look at what is and ask 'why?'; look at what isn't and ask 'Why Not!'
Replied by sambob on topic Google Analytics conflict
Hi Nicholas,
No, that stopped the recording of the campaigns - so no CPC info received since make the change.
No, that stopped the recording of the campaigns - so no CPC info received since make the change.
Don't look at what is and ask 'why?'; look at what isn't and ask 'Why Not!'
Please Log in or Create an account to join the conversation.
13 years 5 months ago #106285
by nicolas
Replied by nicolas on topic Google Analytics conflict
What is the HTML of the page once you confirm the order ?
Please Log in or Create an account to join the conversation.
13 years 5 months ago - 13 years 5 months ago #106406
by sambob
Don't look at what is and ask 'why?'; look at what isn't and ask 'Why Not!'
Replied by sambob on topic Google Analytics conflict
Hi Nicholas, I appreciate your effort.
Attached is the html the thankyou page
Attached is the html the thankyou page
This attachment is hidden for guests.
Please log in or register to see it.
Please log in or register to see it.
Don't look at what is and ask 'why?'; look at what isn't and ask 'Why Not!'
Last edit: 13 years 5 months ago by sambob.
Please Log in or Create an account to join the conversation.
13 years 5 months ago #106508
by nicolas
Replied by nicolas on topic Google Analytics conflict
Hi,
I don't see why it would stop the recording of sales since actually the regex was wrong and the line I gave you was actually not doing anything.
Instead of the line:
add the line:
and that should properly remove the normal GA javascript from the template.
I don't see why it would stop the recording of sales since actually the regex was wrong and the line I gave you was actually not doing anything.
Instead of the line:
Code:
$body = preg_replace("#<script type=\"text/javascript\">.*'https://ssl' : 'http://www') + '\.google-analytics.com.*</script>#siU",'',$body);
Code:
$body = preg_replace("#<script type=\"text/javascript\">.*'https://ssl' : 'http://www'\) \+ '\.google-analytics\.com.*</script>#siU",'',$body);
and that should properly remove the normal GA javascript from the template.
Please Log in or Create an account to join the conversation.
13 years 5 months ago #106580
by sambob
Don't look at what is and ask 'why?'; look at what isn't and ask 'Why Not!'
Replied by sambob on topic Google Analytics conflict
Hi Nicolas,
firstly let me say your product support is the best around; it is greatly appreciated.
Its got me baffled too. I will give you suggestion a try tonight (AU time) ad report back.
Thanks again.
firstly let me say your product support is the best around; it is greatly appreciated.
Its got me baffled too. I will give you suggestion a try tonight (AU time) ad report back.
Thanks again.
Don't look at what is and ask 'why?'; look at what isn't and ask 'Why Not!'
Please Log in or Create an account to join the conversation.
13 years 2 months ago #120483
by sambob
Don't look at what is and ask 'why?'; look at what isn't and ask 'Why Not!'
Replied by sambob on topic Google Analytics conflict
Ok.. all good now.
Recording as expected.
Appreciate it!
Recording as expected.
Appreciate it!
Don't look at what is and ask 'why?'; look at what isn't and ask 'Why Not!'
Please Log in or Create an account to join the conversation.
Time to create page: 0.143 seconds