Order attribution tracking is a feature for store owners seeking clarity on the marketing activities, channels, or campaigns driving orders to their online stores. It allows you to attribute orders to traffic sources, providing an understanding of the effectiveness of various marketing efforts.
With this feature, you can discover what prompted a customer’s purchase on your online store. Be it the Google product listing, the trending TikTok video, the shared Facebook post, or perhaps the email campaign from last week.
Knowing the answers to these questions will help you make more informed decisions about where to invest both your time and money.
Note: With WooCommerce 8.5, Order Attribution Tracking is available on WooCommerce stores and is enabled by default.
Principles of Order Attribution Tracking
↑ Back to topThis new feature makes use of a last-click attribution model — widely adopted and the default for most marketing platforms and attribution tools — it gives 100% of the conversion credit to the last interaction before a customer lands on your site. Whether it’s an ad, email, or product listing, the “last thing” clicked takes full credit for the conversion.
As no data is stored in WooCommerce unless an order is placed and all cookies of this feature expire with each session, this feature cannot be used to track your visitors across sessions.
Here are the essential rules governing order attribution tracking:
- UTM and organic sources take precedence: UTM and organic sources always override any previous source.
- Type-in (direct) never overrides: A direct visit (type-in) never overrides a previously identified source.
- Referral source hierarchy: The referral source overrides the previous source only if there is no current visitor session active. If it’s within the same session (e.g., within 30 minutes of the first site visit in the same browser), a referral source will never override the previous source.
Enable or Disable Order Attribution Tracking
↑ Back to topYou can enable (or disable) this feature by going to WooCommerce > Settings > Advanced > Features > Order Attribution.
Locating and Analyzing Order Data
↑ Back to topNote: Order Attribution Tracking data is available only to orders generated after enabling this feature or updating to WooCommerce 8.5. If you deactivate this feature at any point, orders placed during the disabled period will not incorporate this data.
Order Edit Page
↑ Back to topWithin the order edit page for each new order, you’ll find two meta boxes – “Order attribution” and “Customer history.” These boxes provide more information on the origin of the order and offer a detailed history of the customer’s interactions with your store. These meta boxes show the following information:
- Order attribution: Origin, Source type, UTM campaign (if source type is UTM), and Medium, Device type, and Session page views. UTM Source platform, Creative format, and Marketing tactic parameters are also supported.
- Customer history: Number of orders completed, orders refunded, total spend
Order Table
↑ Back to topThe WooCommerce > Orders table includes a new column that displays the order origin. This column reveals the origin of each order, providing immediate insight into which channels are driving sales.
Data Stored by Order Attribution Tracking
↑ Back to topWoo’s order attribution tracking feature stores the following information when an order is placed:
- Referring source: The URL of the site that referred the visitor to your site.
- UTM parameters: If the URL that referred the visitor to your site includes UTM parameters, we parse these and store the source, medium, campaign, content, and term parameters.
- Device type: The type of device your customer used when placing the order (desktop, tablet, or mobile).
- Session page views: The number of page views in the session before placing the order.
Cookies in Use
↑ Back to topThe order attribution feature uses these cookies:
Cookie name | Data stored | Default expiration policy |
---|---|---|
sbjs_session | The number of page views in this session and the current page path | 30 minutes |
sbjs_udata | Information about the visitor’s user agent, such as IP, the browser, and the device type | Session |
sbjs_first | Traffic origin information for the visitor’s first visit to your store (only applicable if the visitor returns before the session expires) | Session |
sbjs_current | Traffic origin information for the visitor’s current visit to your store | Session |
sbjs_first_add | Timestamp, referring URL, and entry page for your visitor’s first visit to your store (only applicable if the visitor returns before the session expires) | Session |
sbjs_current_add | Timestamp, referring URL, and entry page for your visitor’s current visit to your store | Session |
sbjs_migrations | Technical data to help with migrations between different versions of the tracking feature | Session |
Testing Order Attribution Tracking
↑ Back to topWhen placing orders without any referral or source (i.e., directly from the shop), the origin will always be “Direct.” To conduct tests with various origins, please follow the steps below using an incognito/private window.
Referral
- Go to any website and edit a link
href
in developer tools to point to your store. Add items to the cart and complete the checkout.
Organic
- Go to https://www.google.com/ and edit a link
href
in developer tools to point to your store. Add items to the cart and complete the checkout.
Using UTM Parameters
- Open the store with a URL like
https://yourstorename.com/shop/?utm_source=newsletter&utm_medium=email&utm_campaign=sale&utm_content=utmcontent&utm_term=utm_term
. - Add items to the cart and complete the checkout.
Type-in (Direct)
- Same as above, but without any parameters.
Web Admin
Unknown
- Manually Add an order from the backend
- Then erase the associated metadata from the database:
DELETE FROM `wp_wc_orders_meta` WHERE `order_id` = 93 AND `meta_key` LIKE '_wc_order_attribution%';
DELETE FROM `wp_postmeta` WHERE `post_id` = 93 AND `meta_key` LIKE '_wc_order_attribution%';
Frequently Asked Questions
↑ Back to topWhat about historical order data?
↑ Back to topThis data is available only to orders generated after enabling this feature or updating to WooCommerce 8.5. If you deactivate this feature at any point, orders placed during the disabled period will not incorporate this data.
Does this feature use cookies?
↑ Back to topYes. The cookies listed above are stored in the visitor’s browser. These cookies will expire with the visitor’s session or if they clear their cookie history.
Only in the event of an order the data stored in these cookies will be accessed.
How long is a customer session?
↑ Back to topBy default, a customer’s session is considered to last 30 minutes. The cookies set by this feature expire with the session and cannot be used to track your visitors across multiple sessions or for remarketing.
Cookies are blocked by a Web Application Firewall (WAF)
↑ Back to topSome Web Application Firewalls use rulesets that incorrectly flag the cookies used to capture visitor information for order attribution, leading to 403 Forbidden
errors for visitors. This issue has been recognized by some of the most common ruleset providers:
- Comodo WAF ruleset – released an updated ruleset to whitelist the cookies. If your WAF uses this ruleset, any issue should be resolved by updating to the latest version.
- OWASP core ruleset – recognized the issue, but don’t plan to release a fix. If your WAF uses this ruleset, you should add an exclusion rule to resolve the issue. The rule is available in this Github comment.
Updating your ruleset, adding the exclusion rule, or asking your hosting provider to do so should resolve the WAF issues.
WooCommerce 9.0 introduced another method for avoiding WAF false positives: the wc_order_attribution_use_base64_cookies
filter. Setting this filter to true
will use Base64 encoding for the data captured in the order attribution cookies, avoiding any substrings that may trip up overzealous WAFs:
add_filter( 'wc_order_attribution_use_base64_cookies', '__return_true' );
If those options don’t work resolve the WAF issues, you can disable the order attribution feature entirely at WooCommerce > Settings > Advanced > Features, or programmatically using:
# PHP
update_option( 'woocommerce_feature_order_attribution_enabled', 'no' );
# WP CLI
wp option update woocommerce_feature_order_attribution_enabled "no"
How is the data processed and stored?
↑ Back to topThe order attribution information is stored temporarily using cookies in visitors’ browsers. Only in the event of an order, this data will be read and saved as order metadata.
The cookies in visitors’ browsers expire after each session. WooCommerce’s order attribution feature is not suited to tracking visitors across multiple sessions or aggregating behavioral visitor profiles.
Does the feature integrate with Consent Management Platforms?
↑ Back to topYes, we made WooCommerce’s order attribution compatible with WP Consent API to allow convenient integration with Consent Management Platforms.
What data does Automattic receive?
↑ Back to topIf you have previously opted into sharing data (with Automattic) in WooCommerce, then statistical order attribution data captured as part of this feature will be shared with Automattic on a per-order basis. Customer data, such as email address, billing, or shipping data, will not be transmitted.