Cart Tracking Overview

In this article

WooCommerce cart configuration

Metorik offers cart tracking through the Metorik Helper plugin you install on your website during the setup. You need to be running 1.0.0 or higher to access cart tracking features and version 2.0.0 or higher for the latest functionality including WooCommerce Blocks integration.

You can then go to the cart settings page in Metorik to enable cart tracking:

If at any time you'd like to disable cart tracking, you can do it from this page as well.

Keep in mind, WooCommerce does not track carts at all, so we can only provide data about them from when you enabled cart tracking in Metorik.

Settings

Once cart tracking has been enabled, you'll be able to change the settings for it.

Move email field to the top of checkout: This setting will try move the email field to the top of the checkout. This can help capture emails before checkout is abandoned, but if you have a custom checkout or have configured the checkout's fields, it may cause problems. Try enable it though and check that everything looks good on your checkout afterwards.

Show email usage notice: Enabling this setting will [attempt to] show an email usage notice under the checkout's email field and under the email field of the 'add to cart email popup'. This explains to customers that you're storing their carts and may email them about them later. It also gives them a way to opt-out of your cart emails and prevent Metorik from storing details about their carts in one-click.

You can easily translate the text shown using any WordPress translation plugin you'd normally use. The text domain is metorik.


Add to cart email popup

When this setting is enabled, we'll try to show a small popup/tooltip whenever an item is added to the cart. In there, we ask for the customer's email, giving us the chance to email them later if they don't checkout.

This popup will only ever shown once and will only show for guests, as we'll already know the email of logged-in customers.

  • If it's an AJAX add to cart button the an archive page, we'll try show it right there.
  • If it's a single product page add to cart button, where the page reloads after an item is added to the cart, we'll try show it after the page reload.
  • If your store takes customers to the cart page after adding an item to their cart, we'll try show it there next to the 'Processed to checkout'. You can disable this one by using this code/filter.
  • metorik_acp_should_mark_as_seen is a new filter added in version 2+ of the Metorik Helper that can be used to control if the "add to cart popup" tshould be marked as seen (and thus not popup again) after the first time it's seen. The default is true however, if set to false , then the popup will be shown on every add to cart event until the customer enters their e-mail address. We recommend using this only in special circumstances as it could be perceived as spammy to constantly nag your customers to enter their e-mail.

The popup looks a little bit like this:

By default, it will be placed below the bottom. You can change this and make it on the left for example, by using the metorik_acp_placement filter. So this code for example will place it on the left.

The next setting - Add to cart popup title - lets you change the Save your cart? text to anything else. As soon as the customer's entered a valid email into the email field, we'll link it to their cart.

Of course, you're welcome to customise the template of the popup. To do so, simply add a  add-cart-email-form.php file in your theme under a new metorik folder. So in your theme's folder, you'd create a metorik folder. And then inside of that, you'd create a file named add-cart-email-form.php. You should start by copying the contents of the original template file here. Let us know if you need a hand doing this.

Custom checkout URL

By default we'll send a customer to the checkout page (defined in your WooCommerce settings) after recovering their cart so they can pay. However, you may prefer to send them to the cart or another URL.

In that case, you can use this setting to change the URL they are sent to. Be sure to enter a URL with a forward slash ( /) at the beginning, such as /cart or /shop.

To customise the URL when writing an Engage message, you can append &redirect_url to the {recovery_url} variable and define any redirect URL. For example, inserting a link in an email to {recovery_url}&redirect_url=/ would redirect customers to the home page after recovering their cart. This setting is also useful when sending customers to different pages based on their language, which you can learn more about in this guide.

In version 2.0.3+ of the Metorik Helper, we've introduced a new metorik_cart_recovery_allowed_url_params filter that allows you to control which parameters will be "passed along" during the cart recovery process. This can be handy if you need to add additional query parameters in your cart recovery links. For example to allow the ?additional_tracking=1234 to be part of the recovery url redirect, you could add the following to functions.php or similar:

add_filter( 'metorik_cart_recovery_allowed_url_params', fn($params) => ['additional_tracking'] );

For even more complex rules around how the custom checkout URL is set, you can customize the recovery URL using the metorik_recover_cart_url filter. For example, this code, added to your functions.php or similar, would make it go to the cart:

add_filter('metorik_recover_cart_url', 'mysite_metorik_recover_custom_url');
function mysite_metorik_recover_custom_url() {
    return 'https://mysite.com/cart';
}

Capturing emails from custom inputs

If you have another email input somewhere that guests are putting their email in, you may want to capture/link the email to their Metorik cart.

To do that, all you need to do is add the CSS class metorik-capture-email to the email input.

This can usually be done by editing the code for displaying the input/template (or with some extra JavaScript that adds the class to the input).


Disabling cart tracking programatically

Instead of disabling cart tracking from the Metorik cart settings, you can disable it using a filter:

add_filter('metorik_cart_tracking_enabled', '__return_false');

WooCommerce Blocks Support

As of version 2 of the Metorik Helper plugin, we've added WooCommerce Blocks support for all features of the Metorik Helper plugin, including prompting to save a cart when adding an item to cart as well as during the checkout (via a new opt-in/opt-out checkbox), cart restoration and source tracking. To take full advantage of Woo Blocks support with Metorik, please make sure to upgrade to WooCommerce 9.1 or higher. Additionally, make sure to visit your Metorik dashboard's Cart Settings page to enable some new settings for WooCommerce blocks integration:

Note that in addition to the settings available in your store's cart settings page, we've also added two filters to control these settings programatically on your store:

  • metorik_cart_tracking_opt_in_checkbox_enabled is a new filter to determine if the WooCommerce Blocks checkout should show a cart tracking opt-in. This will override the setting you set in your Metorik Cart Settings (as per the screenshot above)
  • metorik_cart_tracking_opt_in_checkbox_label is a new filter to change the label of the opt-in checkbox in the WooCommerce Blocks checkout. This will override the setting you set in your Metorik Cart Settings (as per the screenshot above)

Shopify cart configuration

There is no need to configure anything in Metorik β€” it will all work from the get-go!


How carts are tracked

Whenever an item is added to a cart, removed from a cart, or any cart-related update happens, your store will send the data to Metorik for storing. No cart data is stored on your site at all, and sending data from your site to Metorik is very quick and has zero impact on your site's performance.

In Metorik, we'll only show you and report on carts that have a valid email attached to them. This means:

1. All carts by logged-in customers.

2. All carts by guests that entered their email through the 'add to cart email popup' or on the checkout page.

We ignore carts without emails as since they don't have any customer information attached to them, we don't want to report on them - this helps keep your data as accurate and reliable as possible. We're considering storing this data in the future, but for now we aren't seeing enough compelling reasons to.

We also ignore carts made by fake/test emails, such as bryce@fakemail.org, so only valid carts come into Metorik.

For more on cart tracking consent + GDPR, please see this help doc.


Cart JS events that trigger sync

Note that this section is only relevant for version 1.x of the Metorik Helper plugin. This functionality was overhauled in version 2.0+ of the Metorik Helper plugin and no longer uses these methods for cart tracking. Instead, see the section further below to customize the actions used for version 2.0+.

We hook into a few WooCommerce Cart JS events to determine when to send a cart.

You can change which events we use by adding some code like this your site:

add_filter('metorik_send_cart_events', function() {
    return 'added_to_cart removed_from_cart updated_cart_totals updated_shipping_method applied_coupon removed_coupon updated_checkout';
});
The above code are all the default events that we send carts for.
You can try removing some from the above events if you'd like to stop carts being sent for them. For example, this code stops Metorik sending the cart when the cart totals are updated or when a coupon is removed from the cart. Your use case will likely vary but this should help you get started:
add_filter('metorik_send_cart_events', function() {
    return 'added_to_cart removed_from_cart updated_shipping_method applied_coupon updated_checkout';
});
This code would be added to your site using a 'code snippets' plugin or the functions.php file.

To disable Metorik's cart tracking when cart fragments are updated (eg. if you have a mini cart plugin causing it to refresh when the cart gets tracked), you can use this additional code:

add_filter('metorik_send_cart_fragments', '__return_false');

WooCommerce actions that trigger sync

Note that this section is only relevant for version 2.0+ of the Metorik Helper plugin.

metorik_initate_cart_sync_events is a new filter allows you to modify the WooCommerce hooks that trigger Metorik to sync cart events for the Cart Tracking feature. This more advanced filter can be used for advanced data syncing needs if you have a custom checkout flow. The default actions that will trigger a sync are:

'woocommerce_add_to_cart',
'woocommerce_applied_coupon',
'woocommerce_cart_item_removed',
'woocommerce_cart_item_restored',
'woocommerce_cart_item_set_quantity',
'woocommerce_after_calculate_totals',

In addition, metorik_synced_cart is a new action hook that fires whenever a cart is synced to Metorik. The hooks only parameter is the cart data that was synced. This hook can be handy for debugging purposes.


Cart reports

You can view a variety of cart-related reports and stats from the carts report here. To learn more about cart reports, please see this help doc.

Cart statuses

Carts in Metorik can have one of several statuses...

In Progress: When a new cart is in-progress. Normally it will have this status right after the cart has started, up until an order was placed or the cart was considered abandoned.

Placed: When a cart is started and the order for it is created in the same session (before the cart has been considered abandoned), it will be given the placed status. You'll be able to see the order that was placed for the cart.

Abandoned: When a new cart has not been updated in 30-60 minutes, we'll consider the cart to be abandoned and mark it as such.

Recovered: When an abandoned cart has been recovered through a Metorik cart recovery link, we'll consider the cart to be recovered. More about cart recovery below.


Note: When storing a new order, it looks up any other existing carts with the same customer/order email last updated within the past 7 days and not linked to any order and then deletes them. This is to prevent people who recently ordered from receiving abandoned cart emails.


Recovering carts

Using  Metorik Engage, you can automatically send cart recovery emails to abandoned carts. To learn more about sending cart recovery emails with Engage, please see this help doc.

Still need help? Contact Us Contact Us