Skip to content

UTM & Affiliate Tracking

Automatically capture UTM parameters and affiliate IDs from URLs and pass them with orders to SparkCRM.

The plugin automatically captures UTM and affiliate parameters from incoming URLs, stores them in a browser cookie, and includes them in all API requests sent to SparkCRM.


How It Works

  1. A visitor arrives at your WooCommerce site with tracking parameters in the URL
  2. The plugin reads the parameters and stores them in a spark_tracking cookie
  3. The cookie persists for 30 days across page views and sessions
  4. When the visitor places an order, the stored tracking data is automatically included in the API request to SparkCRM

This uses last-touch attribution — if a visitor returns via a different tracking link, the cookie is overwritten with the new parameters.


Supported Parameters

UTM Parameters

Parameter Example Description
utm_source google Traffic source (e.g., google, facebook, newsletter)
utm_medium cpc Marketing medium (e.g., cpc, email, social)
utm_campaign spring_sale Campaign name
utm_term running+shoes Paid search keyword
utm_content banner_ad Ad content or variant

Affiliate Parameters

Parameter Alias Description
affiliate_id Primary affiliate identifier
affiliate Alternative affiliate identifier
sub_affiliate_id sub1 Sub-affiliate ID 1
sub_affiliate_id_2 sub2 Sub-affiliate ID 2
sub_affiliate_id_3 sub3 Sub-affiliate ID 3
sub_affiliate_id_4 sub4 Sub-affiliate ID 4
sub_affiliate_id_5 sub5 Sub-affiliate ID 5
cohort Cohort identifier

Sub-affiliate aliases (sub1 through sub5) are automatically mapped to their canonical parameter names.


URL Examples

UTM tracking:

https://yourstore.com/?utm_source=google&utm_medium=cpc&utm_campaign=spring_sale

Affiliate tracking:

https://yourstore.com/?affiliate_id=AFF123&sub1=creative_a&sub2=landing_v2

Combined:

https://yourstore.com/?utm_source=facebook&utm_medium=paid&affiliate_id=AFF456&sub1=ad_set_1

Property Value
Name spark_tracking
Format JSON-encoded object
Expiry 30 days
Path / (entire site)
Secure Yes (when site uses HTTPS)
SameSite Lax

Example cookie value:

{
    "utm_source": "google",
    "utm_medium": "cpc",
    "utm_campaign": "spring_sale",
    "affiliate_id": "AFF123",
    "sub_affiliate_id": "creative_a"
}

SparkCRM Attribution

When tracking data reaches SparkCRM, it is stored on the order record and used for:

  • Order attribution — See which source, campaign, or affiliate drove each order
  • First-touch attribution — The first approved transaction locks attribution on the customer record permanently
  • Affiliate postbacks — Sub-affiliate IDs are available as tokens in postback URLs
  • Reporting — Filter and analyze orders by UTM source, campaign, affiliate, and more

No Configuration Required

Tracking is enabled automatically when the plugin is active. There are no settings to configure — simply ensure your marketing URLs include the supported parameters.

Navigation

Type to search…

↑↓ navigate↵ selectEsc close