1. Home
  2. Custom Scripts & Codes
  3. ClickMagick purchase events

ClickMagick purchase events

Vendors using ClickMagick to track purchase events can use the following code to add to their checkouts so that products and order amounts are added to their tracking. To learn how to add codes to your checkout, please check out our article here.

<script>
(function() {
var img = new Image();
img.width = 1;
img.height = 1;
img.src = '//www.clkmg.com/api/s/pixel/?uid=XXX&att=2&amt=' + (_thrive_order.order.product.total_readable) + '&ref='; document.body.appendChild(img);
})();
</script>

You need to replace the ‘XXX’ with your ClickMagick ID.

Remember

ThriveCart ClickMagick purchase event  codes go in your “if the customer purchases…” tracking fields. They will be automatically loaded and triggered on the ThriveCart hosted success page for post-purchase automation, including trying to load these prior to redirecting to any custom success page you have set up.

Troubleshooting

ProblemSolution
Orders are not being trackedMake sure your codes are added to the “if the customer purchases…” tracking fields.

It’s also possible that customers are blocking tracking, either using a browser, browser extension, or ad-blocker that prevents JavaScript tracking – or if the customer does not complete the sales funnel and reach the success page (if they close their browser before being redirected to the success page). While Thrivecart would track a transaction as completed shortly after a customer quits the funnel, the tracking script would be firing on the success page.

Frequently Asked Questions (FAQs)

  • Q: Can I place ClickMagick code on upsell pages?
    • A: We’ve seen some issues with attempting to embed Clickmagick code directly into an upsell pages HTML and so would recommend placing this code into the “Tracking” settings within your upsell directly.
  • Q: Can I use ClickMagick tracking code if I’m using a custom success page, or custom upsell pages?
    • A: Yes, you can! ThriveCarts custom success page setup will always load quickly in the backend before redirecting the customer to your custom pages. This ensures that any custom javascript on the success page fires before the redirect – just make sure you don’t have ClickMagick tracking code also added to your custom success/upsell pages.
Updated on November 27, 2025
Was this article helpful?

Related Articles