WooCommerce: Source Tracking

Through the  Metorik Helper plugin, Metorik tracks where your customers come from and the UTM tags present when they come to your site. The data it tracks is used in the sources report and also available to you in the order filters and exports.

This data is only tracked from the moment you installed the Metorik Helper plugin on your site, since WooCommerce itself doesn't track it so we have no way of getting the historical source data.

By default, a cookie lasts in your customer's browser for 6 months.

By default, a customer's session is considered 30 minutes.

The session time affects only referral sources overriding. When a visitor comes on your site for the first time, Metorik receives and stores data about a source. After some time, this visitor might return to your website, but from another source, and we need some rules to decide if we should overwrite previous source or not.

The rules Metorik uses are aligned with Google Analytics:

  • UTM and Organic sources always override any previous source.
  • Type-in (direct) never overrides a previous source.
  • Referral source overrides previous source only if there is no user session at the moment. If it’s within the same session (eg. within 30 minutes of first coming to the site) - a referral source will never override previous source.

Explanation to referral logic: sometimes visitor within a current visit (session) comes to a website from a “source” which is not actually a “source”. For example, it can be visit from an email service, where he had a registration activation link.

For more information on UTM parameters, check out this  beginner's guide and Buffer's complete guide.

Note: Behind the scenes, Metorik currently uses the fantastic sourcebuster.js library. For technical details, check out the documentation, and feel free to ask us questions about it.

Order sources

The source is set on an order during the checkout.

Customer sources

The source is set on a customer when they first register (either through the account page or during the checkout). If they don't have a source at that time, they won't have one set on their profile ever (just on orders they make in the future).

My sources report is empty

Keep in mind: Metorik is only able to track the source from when you started using Metorik.

But if it's been a few days and your sources report is still empty, Metorik is likely unable to record the source in the order data.

Normally this is due to a custom checkout or checkout changes. To fix this, make sure your checkout page has the following code somewhere:

<?php do_action( 'woocommerce_after_order_notes', $checkout ); ?>

This should be there by default but if you've removed it, Metorik will have trouble storing the source data.

Let us know if you need a hand fixing this up.

Changing the cookie & session times

It's possible to change the time we remember cookies for and how long sessions last, by adding some custom code to your site through the functions.php file or a plugin like  Functionality. Cookies are in months and sessions are in minutes.

Change how long cookies are remembered (in months):

add_filter( 'metorik_cookie_lifetime', 'mtk_custom_cookie_time' );
function mtk_custom_cookie_time() {
    return 12; // 12 months

Change how long sessions last (in minutes):

add_filter( 'metorik_session_length', 'mtk_custom_session_time' );
function mtk_custom_session_time() {
    return 60; // 60 minutes

Removing the source tracking JavaScript / Cookies

If you'd prefer Metorik didn't track customer session activity and sources, you can remove the JavaScript it adds by using the following code. It can be added to your functions.php or a plugin like  Functionality:

add_action( 'wp_print_scripts', 'mtk_helper_dequeue_scripts' );
function mtk_helper_dequeue_scripts() {

Still need help? Contact Us Contact Us