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.
- Copy JS code from settings directly from tracking settings
- The received JS-code of the online consultant should be added to the “Live Chat” field in the integration settings
- 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.
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 cardopen_cart
- send data about viewing the cart by the customercart
- 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');