Google analytics enhanced link attribution

  • Posts: 195
  • Thank you received: 13
  • Hikashop Business
8 years 9 months ago #231278

-- HikaShop version -- : 2.6.1
-- Joomla version -- : 3.4.8
-- PHP version -- : 5.5.31

We are having an issue with analytics. Transaction data is being reported, but it appears transaction users are being referred from the server's IP location rather than from a referring page. Looking at the hikashopanalytics plugin code I came across this at about line 239.

ga("create", "' . $account . '", "auto");
ga("send", "pageview");'.$extra_required.'
ga("require", "ecommerce", "ecommerce.js");

According to this ( developers.google.com/analytics/devguide...ced-link-attribution ) It appears the above should instead be:

ga("create", "' . $account . '", "auto");'.$extra_required.'
ga("send", "pageview");
ga("require", "ecommerce", "ecommerce.js");

Can anyone provide some insight?


3by400, Inc.
3by400.com
Websites that Work, Marketing that Matters

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

  • Posts: 82867
  • Thank you received: 13373
  • MODERATOR
8 years 8 months ago #231280

Hi,

Yes, it's sounds indeed better to do it like that.
We'll change that on our end.
So is the problem fixed for you with that change ?
Because when you activate the Direct call setting of the plugin, it's normal that it's the server's IP location that is displayed since the notification is sent by the server when the payment notification is received by the server.

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

  • Posts: 195
  • Thank you received: 13
  • Hikashop Business
8 years 8 months ago #231373

I've made the change on the site, but it didn't solve our problem. We are using Google Universal Analytics and the Always Use Direct Call in the plugin is set to No. I haven't checked on exactly what page the site is on when sending the analytics, but per this code:

if($this->params->get('use_universal', 0)) {
$call = false;
if($this->params->get('universal_always_directcall', 0))
$call = true;
if(!$call && !$app->isAdmin()) {
$ctrl = JRequest::getCmd('ctrl', '');
$task = JRequest::getCmd('task', '');
if($ctrl == 'checkout' && $task == 'notify')
$call = true;
}

if($call)
return $this->googleDirectCall($accounts, $order, $currencyInfo);
}
return $this->googleGetJS($accounts, $order, $currencyInfo);

it would seem that the only way we would be using the JS solution, which seems to be what we need because we have to have the customer's IP location for analytics / Adwords, is if the $task is NOT 'notify'. I'm working on figuring that out now.


3by400, Inc.
3by400.com
Websites that Work, Marketing that Matters

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

  • Posts: 195
  • Thank you received: 13
  • Hikashop Business
8 years 8 months ago #231382

As an addition to my previous post, we are using two payment methods. Both are 'off-site'. One is PayPal. The other is Authorize.net. In both cases Google analytics is reporting the location of the transaction as the location of the server's IP.

Nicolas (or whomever): Is there a way to disable use of the direct call completely other than making a code change? And, since that call, as you stated earlier, normally uses the server IP address rather than a customer's IP address, why is the direct call the apparent preferred method of reporting analytics for the notify page?


3by400, Inc.
3by400.com
Websites that Work, Marketing that Matters
Last edit: 8 years 8 months ago by 3by400. Reason: Looking for more clarification / understanding of the plugin.

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

  • Posts: 82867
  • Thank you received: 13373
  • MODERATOR
8 years 8 months ago #231383

Hi,

This is the problem. The system will use the JS method when the order is not paid with a payment method which does a payment notification server to server.
But in your case, it's probable that your orders are confirmed with a payment notification and thus it still uses a direct call.

In that case, removing that code:
if($call)
return $this->googleDirectCall($accounts, $order, $currencyInfo);
should help in your case and I don't see an alternative.

Direct call is better because you get accurate statistics. With the javascript method, it requires the user to display a page of your website with the javascript added to it. So the plugin adds it to the thank you page of your website after the use comes back from the payment gateway. There are many reasons why the javascript might not be launched:
- a javascript error on the page
- the user closing the page before the page is fully loaded
- the internet connection of the user stopping during the redirection from the payment gateway
- the user stopping the redirection or not clicking on the button on the payment gateway to be redirected to your website
And if the javascript is not launched, the sale is not counted.
But with the direct call method, the sale is counted when the payment gateway tells HikaShop that the payment has been done. So if the order is confirmed in HikaShop, you'll see it in the statistics 100% of the time.
Since merchants normally want accurrate statistics, the direct call method is the recommanded one.

Last edit: 8 years 8 months ago by nicolas.

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

  • Posts: 195
  • Thank you received: 13
  • Hikashop Business
8 years 8 months ago #231669

Thanks for the explanations on JS versus direct call. While helpful the solution to our issue was found it seems by adding an optional parameter to the measurement protocol parameters in the googleDirectCall method.

Right after the 'cid' => $uuid,

I added: 'uip' => $order->order_id,

This serves to tell GA the IP of the customer rather than the server. And that's exactly what we needed.


3by400, Inc.
3by400.com
Websites that Work, Marketing that Matters

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

  • Posts: 82867
  • Thank you received: 13373
  • MODERATOR
8 years 8 months ago #231678

Hi,

That's a good idea ! I suppose that you meant to write order_ip instead of order_id in your uip parameter. We'll add that on our end too for next version.

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

  • Posts: 195
  • Thank you received: 13
  • Hikashop Business
8 years 8 months ago #231726

Yep. $order->order_ip, not order_id. Seems to be working well so far.


3by400, Inc.
3by400.com
Websites that Work, Marketing that Matters

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

Time to create page: 0.069 seconds
Powered by Kunena Forum