Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Электронная торговля Google Analytics


Recommended Posts

Спасибо, а подскажите это решение поможет ?

В 12.01.2016 в 11:15, kisluk сказал:

Для OpenCart 2.x. Создаем GA_ecommerce.ocmod.xml и добавляем в него код:

  Скрыть контент

<?xml version="1.0" encoding="utf-8"?>
  <name>Google Analytics - Ecommerce Tracking</name>

	<file path="catalog\controller\checkout\success.php">
		<search><![CDATA[if (isset($this->session->data['order_id'])) {]]></search>
			<add position="after"><![CDATA[
			$data['order_id'] = $this->session->data['order_id'];
                        $data['store_name'] = $this->config->get('config_name');

                        $data['order_info'] = $this->model_account_order->getOrder($this->session->data['order_id']);

                        $data['order_products'] = $this->model_account_order->getOrderProducts($this->session->data['order_id']);

                        $tax = 0;
                        foreach($data['order_products'] as $row){
                            $tax = $tax + $row['tax'];
                        $data['tax'] = $tax;

	<file path="catalog\view\theme\*\template\common\success.tpl">
			<search><![CDATA[<?php echo $footer; ?>]]></search>
			<add position="before"><![CDATA[
			<?php if(isset($order_id) && $order_id) { ?>
    <script type="text/javascript">

        var _gaq = _gaq || [];
        _gaq.push(['_setAccount', 'UA-xxxxxxxx-x']);
        _gaq.push(['_set', 'currencyCode', '<?php $order_info["currency_code"]; ?>']);

          '<?php echo $order_id; ?>',           // transaction ID - required
          '<?php echo $store_name; ?>',  // affiliation or store name
          '<?php echo $order_info["total"]; ?>',          // total - required
          '<?php echo $tax; ?>',           // tax
          '<?php echo $order_info["shipping_city"]; ?>',       // city
          '<?php echo $order_info["shipping_zone"]; ?>',     // state or province
          '<?php echo $order_info["shipping_country"]; ?>'             // country

        <?php foreach ($order_products as $row) { ?>
            '<?php echo $order_id; ?>',           // transaction ID - required
            '<?php echo $row["model"]; ?>',           // SKU/code - required
            '<?php echo $row["name"]; ?>',        // product name
            '<?php echo $row["price"]; ?>',          // unit price - required
            '<?php echo $row["quantity"]; ?>'               // quantity - required
        <?php } ?>


        (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);

    <?php } ?>


Файл GA_ecommerce.ocmod.xml заливаем в каталог /system/ (или в админке добавляем) и обновляем модификации. UA-xxxxxxxx-x в коде меняем на свой id в GA.


Link to comment
Share on other sites

  • 1 month later...

@Apostoll , точно не помню, вроде бы данные не отправлялись.


Воспользовался платным модулем https://www.opencart.com/index.php?route=marketplace/extension/info&extension_id=25965.


Программист знает русский язык. Так что проблем с установкой не возникнет.

Edited by kisluk
Link to comment
Share on other sites

  • 1 month later...

Есть очень интересный модуль для полной синхронизации аналитика, адвордс и тегменеджера - Google Marketing Tools. Стоит 99 зеленых, но для стран кроме Украины он реально полезный на все 100%.

Link to comment
Share on other sites

  • 2 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.