# SamCart UTM Tracking Integration

Track campaign attribution through SamCart with HandL UTM Grabber, capturing UTM parameters, click IDs, referrer data, and landing pages on checkouts and sales.

# Pass UTMs to SamCart Checkout with UTM Grabber

## UTM attribution overview

SamCart captures URL parameters at checkout time. HandL UTM Grabber stores attribution in cookies. This guide shows how to connect the two using utm-out links, SamCart Tracking settings, and hidden custom fields prefilled from handl\_utm.

### What you need to know

SamCart stores UTM parameters present in the URL when an order is placed ([SamCart UTM docs](https://help.samcart.com/support/solutions/articles/60000506442-track-utm-parameters)). Like ThriveCart, SamCart does not read cookies from your landing page. You need to get UTM Grabber data onto the checkout URL or into hidden fields.

### Step 1: Configure SamCart Tracking &amp; Pixels

In **Marketplace Settings &gt; Tracking &amp; Pixels**, map standard parameters:

- Source → `utm_source`
- Medium → `utm_medium`
- Campaign → `utm_campaign`
- Content → `utm_content`

Add custom parameters (e.g. `gclid`, `fbclid`) via **Add Parameter** on the same tab.

### Step 2: Append UTMs with `utm-out`

```
<a href="https://checkout.samcart.com/products/your-product/" class="utm-out">Buy Now</a>
```

UTM Grabber rewrites the href with all tracked cookie values. See [utm-out class guide](https://docs.utmgrabber.com/books/102-getting-started-for-handl-utm-grabber-v3/page/appending-utms-to-the-buttons-using-class-name-attributes-selectively).

### Step 3: Hidden custom fields for click IDs

1. Create custom fields in SamCart (e.g. `gclid`, `fbclid`)
2. Add them as **hidden** fields on your checkout page design
3. Paste this in **Products &gt; Advanced &gt; Embed HTML/Scripts in Footer**:

```
<script>
setTimeout(function() {
    if (typeof handl_utm === 'undefined') return;
    Object.keys(handl_utm).forEach(function(key) {
        var val = handl_utm[key];
        if (!val) return;
        jQuery('input[name="' + key + '"], input[id*="' + key + '"]').val(val);
        jQuery('[data-field="' + key + '"]').val(val);
    });
}, 1500);
</script>
```

For limitations and webhook method, see [Webhook on success page](https://docs.utmgrabber.com/books/samcart-integration/page/track-utms-in-samcart-via-webhook-on-success-page).

# Track UTMs in SamCart via Webhook on Success Page

## UTM attribution overview

This walkthrough covers sending full UTM Grabber data from SamCart to Zapier, Make, or your own webhook. Handy when you need gclid, fbclid, first-touch fields, or custom params alongside the lead or order.

For the primary setup, see [the main SamCart guide](https://docs.utmgrabber.com/books/samcart-integration/page/pass-utms-to-samcart-checkout-with-utm-grabber).

### When a webhook makes sense

Native fields in SamCart often stop at basic UTMs. A webhook lets you push everything UTM Grabber stores without trimming values or losing click IDs.

### Thank-you page script

Paste this on your confirmation page. Swap in your Zapier or Make hook URL.

```
<script>
var qvars = {};
window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m, key, value) {
    qvars[key] = decodeURIComponent(value.replace(/\+/g, ' '));
});
qvars = Object.assign({}, (typeof handl_utm !== 'undefined' ? handl_utm : {}), qvars);
setTimeout(function() {
    var data = new URLSearchParams(qvars).toString();
    var xmlHttp = new XMLHttpRequest();
    xmlHttp.open('GET', 'https://hooks.zapier.com/hooks/catch/YOUR_ID/YOUR_KEY/?' + data, true);
    xmlHttp.send(null);
}, 1000);
</script>
```

Full pattern explained in [Triggering Zapier on Thank you Page](https://docs.utmgrabber.com/books/zapier-integration/page/triggering-zapier-on-thank-you-page).

### Quick Zapier / Make checklist

1. Create a Catch Hook trigger and copy the URL
2. Run a test conversion with UTMs in the landing URL
3. Confirm gclid, utm\_source, and email (if present) show up in the payload
4. Map fields into your CRM or spreadsheet

Parameter reference: [Native WP Shortcodes](https://docs.utmgrabber.com/books/102-getting-started-for-handl-utm-grabber-v3/page/native-wp-shortcodes).

Make users: see [Make Integromat integration](https://docs.utmgrabber.com/books/integromat-integration).