How to Track SureCart Sales in Fathom Analytics: 3 Integration Methods

Doug

Tech Stack Integrator

If you’re using SureCart to sell products or manage your eCommerce setup and you’re interested in tracking that activity in Fathom Analytics (get a $10 credit with my link!), this tutorial walks you through three different ways to integrate the two tools. Whether you’re an experienced Fathom user or you’re just learning about it, I’ll show you how to go from zero data to fully tracking your SureCart sales.


Why Use Fathom Analytics?

Let’s start here. If you’re not already using Fathom Analytics, you might be wondering, “Why Fathom over Google Analytics?”

Here’s the short version:
Google Analytics has become bloated, overly complex, and increasingly difficult to navigate. I’ve completely moved away from it for my own business and for my clients. Fathom is clean, simple, privacy-focused, and most importantly—it just works. It gives me and my clients the data we actually want without the noise.

So whether you’re a Fathom fan or you’re exploring it as an alternative to Google Analytics, this tutorial is going to show you how to push your SureCart sales data into Fathom using one of three methods.



Overview: Three Integration Methods

There are three general ways to track SureCart sales in Fathom Analytics:

  1. Using a Confirmation Page (Page Load Tracking)
  2. Using Updated PHP Code in functions.php
  3. Using a Custom Plugin for Dynamic Tracking (Built by me)

Each method has its own pros and cons, and I’ll break them down so you can choose what fits best for your setup.


Method 1: Page Load Conversion Tracking with a Thank You Page

This method takes the most time to implement and requires the most maintenance for future products that you add to SureCart and wish to track.

How It Works:

You create a custom thank-you page for each product that buyers are redirected to after checkout. When this page loads, you fire a Fathom event using the basic script.

Where to Use It:

  • Instant Checkout – Unique checkout page per product
  • Custom Forms – Unique checkout page per product
  • Global Checkout with a shared confirmation page

How to Implement:

  1. Copy and edit the page load tracking script.
  2. In SureCart, set the confirmation page URL for your product or form.
  3. Add the tracking script to that page using:
    • HTML block (in Gutenberg or page builder)
    • Hook inserter (if using Astra Site Builder)
    • Code plugin

Script to copy:

<script>
window.addEventListener('load', (event) => {
  fathom.trackEvent('widget purchase', {
    _value: 1000, // Value is in cents
  });
});
</script>

You can customize the script to fire a unique event like “course_purchase” or “membership_sale.”

Major Downside:

This method fires the event every time the page loads—not just after an actual purchase. If someone refreshes the page or visits it manually, the event is triggered again.


Method 2: Use PHP Code in functions.php for Generic Purchase Tracking

If you’re looking for a more reliable method that isn’t based on page views, this is a solid step up.

How It Works:

You take code (originally provided by SureCart) and drop it into your functions.php file to listen for purchase events and send a custom event to Fathom.

But—there are two big issues with the original SureCart example:

  1. It incorrectly handles cents vs. dollars (Fathom already converts this internally).
  2. It uses outdated Fathom syntax, including deprecated conversion IDs.

So I’ve updated the function and made it easier to implement.

How to Implement:

  1. Go to your WordPress Admin → Appearance → Theme File Editor.
  2. Open your child theme’s functions.php file.
  3. Paste the updated function code (placeholder below).

Function/Script to copy:

add_action(
    'wp_footer',
    function() {  ?>
        <script>
            document.addEventListener('scCheckoutCompleted', function(e) {
                const checkout = e.detail;
                if (checkout && checkout.amount_due) {
                    fathom.trackEvent('Generic Purchase', {
                        _value: checkout.amount_due // Value in cents, as Fathom expects
                    });
                }
            });
        </script>
    <?php }
);

This method will push a generic event to Fathom every time a purchase happens. You’ll see entries like “purchase” or “checkout_complete” in your analytics dashboard depending on what you put in the script above.

Limitation:

While it sends over the price of the product, it doesn’t tell you which product was purchased. It’s still useful—but not as powerful or granular as method three.


Method 3: Use My Custom Plugin for Full Product & Price Tracking (Recommended)

This is by far the best method—if you want detailed product-level analytics in Fathom. I created a lightweight plugin that dynamically tracks the product name and amount for every SureCart purchase and sends that data into Fathom Analytics.

Why This Plugin Is Awesome:

  • Tracks the exact product name purchased.
  • Sends the exact price, including coupons or custom amounts.
  • Allows you to track where the purchase came from—YouTube, newsletter, social media, etc.
  • Lets you calculate conversion rates per product, not just generically or at the page level.

How It Works:

Every time a SureCart purchase is completed, the plugin:

  1. Captures the product name and price.
  2. Sends that information as an event to Fathom.
  3. Displays the product name and conversion value directly in your analytics dashboard.

Where to Get It:

This plugin is available exclusively to members of Convology+. If you’re a member, you’ll find it inside the Resource Library.

Want to DIY? Use the Code

If you’re comfortable working with PHP and your functions.php file then you can use this code directly without the plugin.

Script to Copy:

add_action(
    'wp_footer',
    function() {  ?>
        <script>
            document.addEventListener('scCheckoutCompleted', function(e) {
                const checkout = e.detail;
                let eventName = 'Generic Purchase';

                if (
                    checkout &&
                    checkout.line_items &&
                    checkout.line_items.data &&
                    checkout.line_items.data.length > 0 &&
                    checkout.line_items.data[0].price &&
                    checkout.line_items.data[0].price.product &&
                    checkout.line_items.data[0].price.product.name
                ) {
                    eventName = checkout.line_items.data[0].price.product.name;
                }

                if (checkout && checkout.amount_due) {
                    fathom.trackEvent(eventName, {
                        _value: checkout.amount_due // in cents
                    });
                }
            });
        </script>
    <?php }
);

Paste that into your functions.php or drop it into your own custom plugin.


Last Step: Set Your Currency in Fathom

To get your eCommerce revenue showing correctly:

  1. Go to Fathom Analytics → Settings → Events.
  2. Find your event (e.g., “course_purchase” or “membership_sale”).
  3. Set the correct currency (e.g., USD, EUR).
  4. Optional: Delete test events

You’ll now see conversion values in your reports. Fathom makes this super simple and clean.


Final Thoughts

There you have it—three solid ways to push SureCart purchase data into Fathom Analytics:

Method 1 – Easy to set up but not accurate
Method 2 – Reliable but lacks product-level detail
Method 3 – The gold standard: full product and revenue tracking

If you’re serious about knowing what’s converting, where your sales are coming from, and how to optimize your funnels, Method 3 is the one you want to implement.

And if you’re part of Convology+, grab the plugin—it’ll save you the hassle and get you up and running in minutes.

Need more help? I’ve got more SureCart and Fathom tutorials on the way. Be sure to subscribe to my free newsletter and I’ll let you know when those are out. 🚀