> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Adobe Commerce and ClickFlare Integration Guide

> Track Adobe Commerce (Magento) orders in ClickFlare: add the tracking script to the HTML Head, allow it in CSP and fire a conversion on the success page.

![Adobe Commerce and ClickFlare Integration](https://mintcdn.com/clickflare/gS923ib4WFySqxSL/images/integrations/covers/adobe-commerce.png?fit=max\&auto=format\&n=gS923ib4WFySqxSL\&q=85\&s=b5f44a49c5bfa505b3507be9e8ea6c6e)

Adobe Commerce, formerly Magento, is an e-commerce platform you host yourself or on Adobe's cloud. Your catalog, cart, checkout and checkout success page run on it, and each store view has its own design settings.

ClickFlare tracks the ad click. This guide connects the two so every order is attributed to the campaign, traffic source and ad that brought the buyer. Data moves from the store to ClickFlare:

* **The ClickFlare script** goes in the store view's **HTML Head**, so every page records the visit and keeps the click ID in the browser.
* **A conversion script** on the checkout success page reports the order to ClickFlare with the order number and total.

Unlike hosted platforms, Adobe Commerce has no admin field that fills order data into a script. Putting the order number and total into the conversion script takes a small change to the success page template, made by whoever maintains your theme. The steps below say exactly what that change needs to do.

> [!NOTE]
>
> Server-side reporting is more reliable than a browser script, because ad blockers and cookie limits can't stop it. Adobe Commerce can send webhooks with fields you name yourself, but only a developer can set that up, and the click ID has to be saved on the order first. See [Server-side option](#server-side-option).

***

## At a glance

To set up Adobe Commerce with ClickFlare:

1. Set up a tracking domain and campaign.
2. Create the store as an offer.
3. Add the script to the HTML Head.
4. Allow your tracking domain in CSP.
5. Add the conversion to the success page.

Each step is explained in [Setup](#setup).

| | Adobe Commerce + ClickFlare |
| - | - |
| **How it connects** | Direct tracking script + success page script |
| **What reaches ClickFlare** | Store visits, orders, order total, order number |
| **Timing** | Real time, per conversion |
| **Key parameters** | `click_id={cf_click_id}`, `cpid={campaign_id}`, `payout`, `txid`, `ct` |
| **Works with** | Each store view, redirect and direct campaigns |
| **Good to know** | Allowlist the tracking domain in CSP or checkout blocks it. |

***

## How the data flows

```text theme={null}
Ad click
  → https://trk.yourdomain.com/cf/r/CAMPAIGN?...        (redirect campaign)
     or the ad links straight to the store                 (direct campaign)
  → https://yourstore.com/?click_id=CF_CLICK_ID&cpid=CAMPAIGN_ID
     (the ClickFlare script in the HTML Head records the visit
      and keeps the click ID in the browser)
  → Product page → cart → checkout
  → Checkout success page
     (the conversion script fires:
      https://trk.yourdomain.com/cf/cv?payout=ORDER_TOTAL&txid=ORDER_NUMBER&ct=sale
      and adds the click ID it finds in the browser)
  → ClickFlare matches the order to the original click
```

| Piece | Where it lives in Adobe Commerce | Who sets it up |
| - | - | - |
| ClickFlare tracking script | **Content → Design → Configuration → HTML Head → Scripts and Style Sheets** | You, in the Admin |
| CSP allowlist entry | Your Content Security Policy settings | You or your developer |
| Conversion script | Checkout success page template | Your developer |

***

## What you'll need

* A ClickFlare account with your **own tracking domain**. Shared domains get flagged by ad platforms and blocked by browsers. See [Tracking domains](/docs/en/settings/tracking-domains.md).
* Adobe Commerce Admin access to **Content → Design → Configuration**.
* Someone who can edit the theme's checkout success page and your Content Security Policy.

> [!NOTE]
>
> The Admin steps come from Adobe's guide for Adobe Commerce on cloud infrastructure and on-premises. On Adobe Commerce as a Cloud Service, or on Magento Open Source, check that the same settings are there before you start.

***

## Setup

**1. Set up your own tracking domain**

Add a custom tracking domain such as `trk.yourdomain.com` before anything else. Both scripts load from it, and the conversion script only finds the click ID when they use the same domain as the campaign. See [Tracking domains](/docs/en/settings/tracking-domains.md).

**2. Create the custom conversion (optional)**

Go to **Settings → Custom Conversions**, click **Add** and create **Sale** with the parameter `sale`, **Include in Conversions** and **Include in Revenue** turned on. The value in `ct` must match it exactly. See [Custom conversions](/docs/en/settings/custom-conversions.md).

**3. Create the campaign**

Go to **Campaigns → New Campaign**, pick your traffic source and tracking domain, and choose **Redirect** (if the source allows redirects) or **Direct** (Google Ads and other sources that don't). Create one campaign per traffic source. See [Creating a campaign](/docs/en/campaigns/creating-a-campaign-in-click-flare.md).

**4. Create the store as an offer**

In the campaign path, create the offer inline with your store or product page URL and the ClickFlare tokens:

```text theme={null}
https://yourstore.com/?click_id={cf_click_id}&cpid={campaign_id}
```

For a direct campaign, turn on the **Direct Tracking** switch in the offer. Save the campaign and copy the tracking script from its **Tracking** tab.

> [!WARNING]
>
> Keep the braces: `{cf_click_id}`. Without them the store receives the literal text `cf_click_id`.

**5. Add the script to the HTML Head**

In the Admin, go to **Content → Design → Configuration**. Find the store view and click **Edit**. Under **Other Settings**, expand **HTML Head** and paste the script in **Scripts and Style Sheets**:

```html theme={null}
<script async defer src="https://trk.yourdomain.com/cf/scripts/direct?cpid=CAMPAIGN_ID"></script>
```

Click **Save Configuration**. The setting is per store view, so repeat it for every store view that gets ClickFlare traffic. You can use the **Miscellaneous HTML** field in the **Footer** section instead if you prefer the script before the closing body tag. See [Direct tracking](/docs/en/tracking/direct-tracking-clickflare.md).

**6. Allow your tracking domain in CSP**

Adobe Commerce doesn't run JavaScript from the **Scripts and Style Sheets** or **Miscellaneous HTML** fields on the checkout pages unless it is allowlisted in the Content Security Policy settings. Add your ClickFlare tracking domain, for example `trk.yourdomain.com`, to the CSP allowlist. Do this before the next step: the success page is part of checkout, so a conversion script loaded from a domain that isn't allowlisted can be blocked there too.

**7. Add the conversion script to the success page**

In ClickFlare, go to **Settings → Tracking URLs** and copy the JavaScript conversion script. It reads the click ID from the visitor's browser. Remove the `click_id=OPTIONAL` placeholder. See [Conversion tracking pixel](/docs/en/settings/conversion-tracking-pixel.md).

Hand the script to your developer with this brief: on the checkout success page only, output the script with the order's values in the URL:

```text theme={null}
https://trk.yourdomain.com/cf/cv?payout=ORDER_GRAND_TOTAL&txid=ORDER_INCREMENT_ID&ct=sale
```

* `payout`: the order total, as a plain number with no currency sign.
* `txid`: the order number the customer sees. It keeps a reload of the success page from counting twice.
* `ct=sale`: leave it out if you skipped the custom conversion.

The script must load from your tracking domain, so it needs the same CSP allowlisting as the head script.

***

## Why the transaction ID matters

ClickFlare keeps one conversion per click ID unless the transaction ID differs. With the order number as `txid`:

* A buyer who reloads the success page sends the same order number, and ClickFlare doesn't count it twice.
* A second order from the same click has a new number and counts as its own conversion.

Without `txid`, the second order replaces the first.

***

## Server-side option

Adobe Commerce webhooks call an external URL when something happens in the store, and you choose which fields to send and what to name them. On cloud and on-premises installs a developer defines them in `webhooks.xml`; on Adobe Commerce as a Cloud Service they are under **System → Webhooks** in the Admin. Because field names are yours to set, a webhook could post JSON straight to ClickFlare with the keys `cf_click_id`, `payout` and `ct`, with no Zapier or Make in between.

Two things make this a developer project:

* **The click ID isn't on the order.** Adobe Commerce has no Admin setting that saves URL parameters with orders. Your developer has to save the click ID during the visit and copy it onto the quote or order so the webhook can send it.
* **Webhooks run in real time** and can stop the store operation that triggered them if they fail. Have your developer make sure a failed call to ClickFlare never blocks an order.

The benefit is reliability: the order reaches ClickFlare even when the buyer's browser blocks scripts or never loads the success page.

***

## Verify the setup

**1. Click through the campaign**

Open the ClickFlare campaign URL in a private window. The store URL should show `click_id=` followed by a long ID.

**2. Check the scripts load**

In your browser's network tab, look for the request to `/cf/scripts/` on your tracking domain. On the checkout, check the console for CSP errors that name your tracking domain.

**3. Place a test order**

On the success page, look for the request to `/cf/cv` with a real total and order number.

**4. Check ClickFlare**

The order should appear on the campaign with its revenue. In **Logs → Event Logs**, check that `txid` is the order number.

***

## Troubleshooting

> [accordion] The script runs on the store but not on checkout
>
> The tracking domain isn't allowlisted in your Content Security Policy. Add it and test again.

> [accordion] The script only runs on one store
>
> The HTML Head setting is per store view. Add the script to each store view that gets traffic.

> [accordion] Conversions arrive without a campaign
>
> The conversion script found no click ID. Check that the tracking script loads on the landing page, that both scripts use the same tracking domain as the campaign, and that the offer URL has `click_id={cf_click_id}` with braces.

> [accordion] Conversions have no revenue
>
> The success page script sends `payout` empty or with a currency sign. It must be a plain number. See [Troubleshooting S2S postbacks](/docs/en/tracking/troubleshooting-s2s-postback-url-in-clickflare.md) for the general checks.

***

## FAQ

> [accordion] Does ClickFlare integrate with Adobe Commerce?
>
> Yes. The ClickFlare script runs in the store view's HTML Head, and a conversion script on the checkout success page reports each order with its total and order number.

> [accordion] Can I add the conversion script in the Admin without a developer?
>
> You can paste it in **Scripts and Style Sheets**, but that field runs on every page and has no order values, so it would report a conversion on every page view. The success page needs a template change.

> [accordion] Does this work with Google Ads?
>
> Yes. Use a direct campaign. The ad links straight to the store and the script records the visit without a redirect.

> [accordion] Are refunds reported?
>
> No. The success page only reports new orders. Adjust refunds in ClickFlare, or include them in a server-side setup.

> [accordion] Can I send the order back to my traffic source?
>
> Yes. Once ClickFlare records the order, it can pass it to the traffic source through that source's postback or conversion API integration.

***

## Related

> [card] [Direct tracking](/docs/en/tracking/direct-tracking-clickflare.md)
>
> How the on-page script works

> [card] [Conversion pixel](/docs/en/settings/conversion-tracking-pixel.md)
>
> Get the conversion script

> [card] [WooCommerce](/docs/en/integrations/how-to-track-your-woo-commerce-store-with-click-flare-full-funnel-tracking-guide.md)
>
> Another self-hosted store


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.