WooCommerce UTM tracking: where UTMs show on orders
By Devendra Variya, co-founder of Virling. Published 2026-11-17, updated 2026-11-30.
WooCommerce tracks UTM parameters with its built-in order attribution. Open an order in the admin and the Order attribution box shows the origin, source type, UTM campaign, source and medium of the visit that placed it, and the orders list has an Origin column. For revenue by UTM campaign, the WooCommerce Analytics extension has an Orders by Campaign report. Many orders carry no UTM data at all, because the values live in short session cookies. For revenue per campaign after refunds, save a visitor ID on each order and join it to that visitor's tagged visits.
Where WooCommerce stores UTM values on an order
Order attribution is part of WooCommerce. Turn it on or off under WooCommerce, Settings, Advanced, Features. While a visitor browses, a script records the referring site, the UTM source, medium, campaign, content and term, the device type and the session's page views in cookies whose names start with sbjs_. When the visitor places an order, WooCommerce reads those cookies and saves the values on the order, in meta data whose keys start with _wc_order_attribution.
In the admin you see them in two places:
- The Order attribution box on the order page: origin, source type, UTM campaign, source and medium, device type and session page views
- The Origin column in the orders list, such as a UTM source, Organic, Referral, Direct, Web Admin or Unknown
The same page has a Customer history box with the customer's completed orders, refunded orders and total spend. Source: WooCommerce order attribution tracking.
How to see revenue by UTM campaign in WooCommerce
The WooCommerce Analytics extension adds order attribution reports: Orders by Channel, Orders by Source, Orders by Campaign, Orders by Device, and Orders by Channel and Source. WooCommerce describes it as early access and built for single-currency stores, and the reports only cover orders placed while order attribution was on. Source: order attribution report.
Why UTM values go missing
An order only carries UTM values if the script ran, the cookies were set and they lasted until checkout. These are the usual breaks:
- Caching and optimisation plugins. Script delay, combine and minify settings can hold back or break the attribution script, so no cookies are set. Exclude it from those settings and test an order.
- Cookie consent. WooCommerce order attribution works with the WP Consent API, so a consent banner that the visitor declines can stop the cookies, and their order has no source.
- Short sessions. A session lasts 30 minutes by default and the cookies end with it. A buyer who clicks a campaign link today and comes back by typing your address next week is not credited to the campaign.
- Cross-domain pages. Cookies belong to one domain. Landing pages on one domain and a store on another, or a checkout hosted elsewhere, do not share them.
- Email links. Email apps often send no referrer, so an untagged link from a newsletter or an order email arrives as Direct. And because a UTM visit always overrides an earlier source, a tagged order email clicked just before buying takes the credit from the campaign that won the buyer.
- Coupon links. A buyer who leaves to look for a discount code and comes back from a coupon site after their session ended is credited to that site as a referral.
- Orders with no store visit. Orders created in the admin, through the REST API or by import, and subscription renewals, carry no fresh attribution.
Attribution that was never saved cannot be added later. The causes of empty origins and how to test each one are in why WooCommerce order attribution says Unknown. If you are choosing a plugin, use the WooCommerce attribution plugin checklist.
How Virling ties each order to the visit before it
Virling does not rely on a session cookie lasting until checkout. Its script gives each visitor a first-party ID in the virling_vid cookie, kept for a year, and stores the UTM tags of every landing. A short snippet saves that ID on the order, and Virling reads the order from your store's REST API and joins it to that visitor's earlier visits. By default it credits the latest visit in the last 90 days that was not Direct, so a typed return a week later keeps the campaign. Refunds lower the campaign's revenue, and WooCommerce Subscriptions renewals keep the channel of the first payment. The steps below set it up.
A worked example: four orders
Example data, made up to show the method: an imaginary coffee roaster tagged its newsletter and Facebook ad links and compared four orders. The UTM column is what the link carried, the WooCommerce column is the Origin and UTM campaign in the order's Order attribution box, and the last column is the visit Virling joined to the order through the saved visitor ID.
| Order | Total | UTM values on the link | Order attribution in WooCommerce | Joined visit source in Virling |
|---|---|---|---|---|
| #2207 | $36.40 | newsletter / email / spring_blend | Source: Newsletter, campaign spring_blend | newsletter / email / spring_blend |
| #2208 | $72.80 | facebook / paid_social / subscription_trial | Source: Facebook, campaign subscription_trial | facebook / paid_social / subscription_trial |
| #2209 | $48.60 | newsletter / email / spring_blend, clicked 6 days before the order | Direct, no campaign | newsletter / email / spring_blend |
| #2210 | $29.90 | facebook / paid_social / subscription_trial | Unknown, no campaign | facebook / paid_social / subscription_trial |
The buyer of #2209 came back by typing the address after the 30 minute session had ended, so WooCommerce saved Direct. #2210 went through a custom checkout template that did not send the attribution fields, so the order is Unknown; the Virling snippet runs on the server when the order is created, so it still saved the visitor ID. Of the $187.70 in total, WooCommerce gives spring_blend $36.40, subscription_trial $72.80, Direct $48.60 and Unknown $29.90; the joined visits give spring_blend $85.00 and subscription_trial $102.70. Run your links through the UTM checker so a typo does not split one campaign into two rows.
Step 1: tag your links
Add utm_source, utm_medium and utm_campaign to every link you control: newsletters, SMS, ads, creator posts and bio links. Pick one spelling for each source and keep it, because utm_source=newsletter and utm_source=Newsletter split one source in two. The UTM builder makes the links, and the rules are in which UTM parameters to use. Agencies that tag links for several client stores can keep each store's numbers apart, as WooCommerce for agencies shows.
Step 2: check the links
Paste your campaign links into the UTM checker before they go out. It flags a missing source or medium, capitals, spaces, duplicate parameters, tags after the # and tagged internal links, which all split or lose campaign data.
Step 3: add the script
Add the Virling script to every page of the store, including the cart and checkout. On WordPress, the Virling plugin adds the tag for you and survives theme updates; see the framework guides. Leave cookieless mode off for a store, because without the cookie there is no visitor ID for the order to carry. If you need consent first, set the visitor cookie to Until consent, add data-cookieless to the tag, and call virling("consent") from your consent tool when the visitor accepts.
Step 4: save the visitor ID on the order
Add this to your theme's functions.php, or to a snippets plugin, which survives theme updates. It copies the visitor ID from the virling_vid cookie into the order's meta data, for the classic and the block checkout:
add_action('woocommerce_checkout_create_order', 'virling_vid_on_order');
add_action('woocommerce_store_api_checkout_update_order_from_request', 'virling_vid_on_order');
function virling_vid_on_order($order) {
$vid = $_COOKIE['virling_vid'] ?? '';
if (preg_match('/^[A-Za-z0-9-]{8,64}$/', $vid)) $order->update_meta_data('virling_vid', $vid);
}Step 5: connect WooCommerce with a read-only key
In WordPress, open WooCommerce, Settings, Advanced, REST API, and add a key with Read permissions. In Virling, paste the consumer key and the consumer secret joined by a colon, as ck_...:cs_..., and enter your store's https address. Virling imports orders from the last 90 days on the first run, then new ones every minute, and reads orders from the last 60 days again every 6 hours so later refunds show up. Details are on the WooCommerce integration page and in the WooCommerce docs.
Step 6: read revenue per campaign
Open your store from a link with ?utm_source=test&utm_medium=test in a private window, place a test order, and after the next sync it shows the test source in the payments list instead of Unattributed. On the dashboard, the Channels card shows visitors, revenue and revenue per visitor for each channel, and its Campaign tab breaks that down by utm_campaign. Open any order to see the visits before it. Virling credits orders by visit, not by discount code, so give each campaign a tagged link as well as a code.
Virling is open source. Self-host it free, or start the hosted version with a 14-day free trial.
Frequently asked questions
Does WooCommerce track UTM parameters?
Yes, with order attribution turned on under WooCommerce, Settings, Advanced, Features. A script reads the UTM tags of the visit into session cookies, and at checkout WooCommerce copies the source, medium and campaign onto the order.
Where do I see UTM parameters on a WooCommerce order?
Open the order in the admin and look at the Order attribution box. It shows the origin, source type, UTM campaign, source and medium, device type and session page views. The orders list also has an Origin column.
Why do WooCommerce orders have no UTM data?
The attribution cookies were never set or did not reach checkout: a caching or script delay plugin held the script back, the visitor declined cookies, the session ended before buying, or the order was created without a store visit, such as in the admin or as a subscription renewal.
How do I see revenue per UTM campaign in WooCommerce?
The WooCommerce Analytics extension has an Orders by Campaign report, which WooCommerce describes as early access and single currency only. For revenue after refunds per campaign, save a visitor ID on each order and join it to that visitor's tagged visits in your analytics.
Can I add UTM data to orders placed before I turned attribution on?
No. WooCommerce only saves attribution on orders placed while the feature is on, and data that was never saved cannot be filled in later.
See revenue per UTM campaign for your WooCommerce store
Virling is open source under AGPL. Self-host it free, or use the hosted version with a 14-day free trial. It connects to Stripe, Paddle, Shopify, WooCommerce, Polar, LemonSqueezy, Dodo, Creem and RevenueCat.