- Posts: 102
- Thank you received: 3
Enchanced analytics
- Rabbiteggs
-
Topic Author
- Offline
Less
More
10 years 3 months ago - 10 years 3 months ago #242561
by Rabbiteggs
Enchanced analytics was created by Rabbiteggs
-- HikaShop version -- : 2.6.0
-- Joomla version -- : 3.5.0
-- Error-message(debug-mod must be tuned on) -- : Problem with enchanced analytics
Hello,
Does anyone know how to enable enchanced analytics? I try to use plugin for hika, but no results.
I found on forum this code, but it doesn't collect information about revenue by categories and there is no datalayer.push. Thnx.
Code:
-- Joomla version -- : 3.5.0
-- Error-message(debug-mod must be tuned on) -- : Problem with enchanced analytics
Hello,
Does anyone know how to enable enchanced analytics? I try to use plugin for hika, but no results.
I found on forum this code, but it doesn't collect information about revenue by categories and there is no datalayer.push. Thnx.
Code:
Code:
$siteName = '*********';
$account= 'UA-*********';
$app = JFactory::getApplication();
$order_id = $app->getUserState('com_hikashop.order_id');
$orderClass = hikashop_get('class.order');
$this->order = $orderClass->loadFullOrder($order_id);
$order_total = round($this->order->order_full_price, 2);
$shipping_price = round($this->order->order_shipping_price, 2);
$revenue = $order_total - $shipping_price;
$order_total_no_vat = round($this->order->order_subtotal_no_vat, 2);
$tax = $order_total - $order_total_no_vat;
$js = '
<!-- Google Analytics ecommerce -->
<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", "' . $account . '", "auto");
ga("send", "pageview");'.$extra_required.'
ga("require", "ecommerce", "ecommerce.js");
ga("ecommerce:addTransaction", {
"id": "' . $order_id .'",
"affiliation": "' . str_replace(array('\\','"'), array('\\\\', '\\\"'), $siteName) . '",
"revenue": "' . $revenue . '",
"shipping": "' . $shipping_price . '",
"tax": "' . round($tax, 2) . '"
});
';
foreach($this->order->products as $product) {
$js .=
'ga("ecommerce:addItem", {
"id": "' . $order_id . '",
"name": "' . str_replace(array('\\','"'), array('\\\\', '\\\"'), strip_tags($product->order_product_name)) . '",
"sku": "' . str_replace(array('\\','"'), array('\\\\', '\\\"'), $product->order_product_code) . '",
"category": "",
"price": "' . ($product->order_product_price + $product->order_product_tax) . '",
"quantity": "' . (int)$product->order_product_quantity . '"
});
';
}
$js .= '
ga("ecommerce:send");
</script>
<!-- End Google Analytics -->
';
Last edit: 10 years 3 months ago by Rabbiteggs.
Please Log in or Create an account to join the conversation.
10 years 3 months ago #242565
by nicolas
Replied by nicolas on topic Enchanced analytics
Hi,
That code is already in HikaShop. All you have to do is to configure the HikaShop Analytics plugin via the Joomla plugins manager.
Make sure that you use the latest version of HikaShop as we fixed several issues with it since the 2.6.0 which could explain why it doesn't work for you.
Also, you need to properly configure it, so maybe you're missing something in the settings of the plugin. And finally, the statistics can sometimes be delayed in GA, up to 48h.
That code is already in HikaShop. All you have to do is to configure the HikaShop Analytics plugin via the Joomla plugins manager.
Make sure that you use the latest version of HikaShop as we fixed several issues with it since the 2.6.0 which could explain why it doesn't work for you.
Also, you need to properly configure it, so maybe you're missing something in the settings of the plugin. And finally, the statistics can sometimes be delayed in GA, up to 48h.
Please Log in or Create an account to join the conversation.
- Rabbiteggs
-
Topic Author
- Offline
Less
More
- Posts: 102
- Thank you received: 3
10 years 3 months ago #242652
by Rabbiteggs
Replied by Rabbiteggs on topic Enchanced analytics
Hm... I configure plugin so as you write in FAQ , and waited 3-4 days and no results.
Please Log in or Create an account to join the conversation.
10 years 3 months ago #242677
by nicolas
Replied by nicolas on topic Enchanced analytics
Try turning off the "direct call" setting.
Also, can you confirm that you also have a standard Google Analytics plugin setup on your website ?
extensions.joomla.org/extensions/extensi...ers=0&clearfilters=1
Also, can you confirm that you also have a standard Google Analytics plugin setup on your website ?
extensions.joomla.org/extensions/extensi...ers=0&clearfilters=1
Please Log in or Create an account to join the conversation.
Time to create page: 0.184 seconds