|
/ Knowledge Base /Integrations/ Fathom Analytics Integration Guide

Fathom Analytics Integration Guide

You can integrate SureCart purchases with Fathom Analytics. To do this, you need to add some custom code to your site.

The easiest way to add custom code is to use a free code snippets plugin, though you can do this in your theme editor as well.

You can also use the official Fathom Analytics WP plugin to display analytics data directly within your WordPress dashboard.

Integrating Fathom Analytics Using Embed Code

  • Log into Fathom.
  • Click on the Settings.
  • If you create a new site, add your site name and click on Create Site.
  • After your site is created, you’ll see this screen. Copy the embed code provided and paste it into the head section of your website.
  • If you need the embed code for an existing site, click on the site name, then copy your embed code and paste it into the head section of your site.

You can use code snippet plugins such as WPCode to insert this code into your website’s head section.

Using Fathom Analytics WP Plugin For Integration

  • Here, enter your Site ID from your Fathom dashboard.
  • If you have enabled Site Sharing in Fathom, you need to enter your Fathom Analytics account password here. If not, you can leave it blank.
  • Click on the Save Changes button.

Fathom will show all the analytics data from your site within your WordPress dashboard.

Fathom Dashboard

Integrating SureCart Purchases With Fathom Analytics

Events in Fathom allows you to monitor specific actions taken by visitors on your website.

In our case, we want to track each time a customer purchases a product from your SureCart store. To do this,

  • Add this snippet after your embed code. YOUR-EVENT-ID is the Site ID from your Fathom dashboard.
add_action(
    'wp_footer',
    function() {  ?>
        <script>
            document.addEventListener('scCheckoutCompleted', function(e) {
                const checkout = e.detail;
                if( checkout && checkout.amount_due ) {
                    fathom.trackEvent('YOUR-EVENT-ID', checkout.amount_due / 100 );
                }
            });
        </script>
        <?php
    }
);

Thats it! Your SureCart purchases are now officially synced with your Fathom analytics account.

Use this data to gain valuable insights from your customer purchases and improve your site’s overall performance.

We hope this guide helped you. If you have any questions, please don’t hesitate to reach out to our support team. We’re here to help!

Was this doc helpful?
What went wrong?

We don't respond to the article feedback, we use it to improve our support content.

Need help? Contact Support
On this page

Download is Just A Click Away!

Enter your email address and be the first to learn about updates and new features.

E-Commerce Store Launch Checklist Download
Scroll to Top