Google Analytics conflict

  • Posts: 260
  • Thank you received: 25
  • Hikashop Business
9 years 1 month ago #105833

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

File Attachment:

File Name: ga.txt
File Size:2 KB


Ant thoughts on solving these.


Don't look at what is and ask 'why?'; look at what isn't and ask 'Why Not!'
Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 75856
  • Thank you received: 11834
  • MODERATOR
9 years 1 month ago #105948

Hi,

For the country it's easy, just change the line:

'".str_replace("'",'\\\'',@$order->billing_address->address_country)."',	// country

to:
'".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.

  • Posts: 260
  • Thank you received: 25
  • Hikashop Business
9 years 1 month ago #106011

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>


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.

  • Posts: 75856
  • Thank you received: 11834
  • MODERATOR
9 years 1 month ago #106086

Hi,

Add the line:

$body = preg_replace("#<script type=\"text/javascript\">.*'https://ssl' : 'http://www') + '\.google-analytics.com.*</script>#siU",'',$body);

before:
$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.

  • Posts: 260
  • Thank you received: 25
  • Hikashop Business
9 years 1 month ago #106155

Thanks nicolas,

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.

  • Posts: 260
  • Thank you received: 25
  • Hikashop Business
9 years 1 month ago #106248

Hi Nicholas,

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.

  • Posts: 75856
  • Thank you received: 11834
  • MODERATOR
9 years 1 month ago #106285

What is the HTML of the page once you confirm the order ?

Please Log in or Create an account to join the conversation.

  • Posts: 260
  • Thank you received: 25
  • Hikashop Business
9 years 1 month ago #106406

Hi Nicholas, I appreciate your effort.

Attached is the html the thankyou page

File Attachment:

File Name: Thank-you-page.txt
File Size:395 KB


Don't look at what is and ask 'why?'; look at what isn't and ask 'Why Not!'
Attachments:
Last edit: 9 years 1 month ago by sambob.

Please Log in or Create an account to join the conversation.

  • Posts: 75856
  • Thank you received: 11834
  • MODERATOR
9 years 1 month ago #106508

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:

$body = preg_replace("#<script type=\"text/javascript\">.*'https://ssl' : 'http://www') + '\.google-analytics.com.*</script>#siU",'',$body);
add the line:
$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.

  • Posts: 260
  • Thank you received: 25
  • Hikashop Business
9 years 1 month ago #106580

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.


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.

  • Posts: 260
  • Thank you received: 25
  • Hikashop Business
8 years 10 months ago #120483

Ok.. all good now.

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.071 seconds
Powered by Kunena Forum