Setting up tracking of customer actions in WooCommerce
Copy the link to the article
Copied

To work with tracking, you need to activate this option in the system. You can read more about it in the article Connecting Visitor Tracking.

Step 1. Obtaining and placing the tracker code

Note

Tracking and Live Chat use the same tracking mechanism, so it is enough to add JS code of one of them. If an online consultant is already installed on the site, you should ignore this configuration step.

  1. Copy JS code from settings directly from tracking settings
  2. The received JS-code of the online consultant should be added to the “Live Chat” field in the integration settings
  3. After adding the code it is necessary to save the plugin settings.

Step 2. Adding a call to the startTrack function

After adding the tracker code, you need to add in the footer a call to the startTrack function with parameters for tracking data.

  1. To do this, go to PluginsPlugin Editor

  2. Select the plugin WooCommerce Simla.com

  3. In the plugin files, find the file functions.php

And at the end of the file add the code

add_action('wp_footer', function() {
    ?>
    <script>
        jQuery(function() {
            startTrack('page_view', 'open_cart', 'cart');
        });
    </script>
    <?php
});

The result should be as follows

Next, you need to save the changes.

Note that the example of script insertion startTrack('page_view', 'open_cart', 'cart'); specifies all tracking types:

  • page_view - send data about the product viewed by the customer in the product card
  • open_cart - send data about viewing the cart by the customer
  • cart - send data about any changes in the cart (adding, deleting, clearing)

If necessary, you can opt out of some options. For example, if you need to send data only about cart changes, you need to change the script startTrack('page_view', 'open_cart', 'cart'); to startTrack('cart');

Thank you for your feedback.
Was this article helpful?
No
  • Рекомендации не помогли
  • Нет ответа на мой вопрос
  • Текст трудно понять
  • Не нравится описанный функционал
Yes
Previous article
RetailCRM Loyalty Program in WooCommerce
The loyalty program is available in the module starting from version 4.8.0.