|
/ Knowledge Base /Integrations/ General Support Guide for Integrating Analytics with Any Solution

General Support Guide for Integrating Analytics with Any Solution

Many SureCart users want to integrate their store analytics with platforms beyond Google Analytics, such as Facebook Pixel, Fathom, or custom analytics solutions. SureCart provides flexibility for tracking a variety of events and data points to help store owners analyze their business performance across various platforms.

This guide will outline the general steps for integrating SureCart with any analytics platform.

Understanding the Basics

SureCart automatically tracks several key events related to customer behavior in your store. These include:

  • Add to Cart
  • Checkout Initiated
  • Purchase Completed
  • Subscription Started

While SureCart offers built-in integrations for popular platforms like Google Analytics and Facebook Pixel, you can integrate other solutions by leveraging SureCart’s ability to fire custom JavaScript events or send data to third-party platforms via webhooks or API connections.

General Steps for Analytics Integration

To integrate SureCart with any analytics solution, follow these general steps:

Step 1: Identify the Key Events to Track

Decide which events are critical to your store. Some common events include:

  • View Product
  • Add to Cart
  • Begin Checkout
  • Purchase Completed
  • Subscription Start

SureCart fires these events automatically, and you can listen to them or customize the events you want to track.

Here is a table for all the events that can be tracked in SureCart:

EventEvent NameDescription
scAddedToCartAdded to CartTriggered when a customer adds an item to their shopping cart.
scRemovedFromCartRemoved from CartTriggered when a customer removes an item from their shopping cart.
scViewedCartViewed CartTriggered when a customer views their shopping cart.
scProductViewedProduct ViewedTriggered when a customer views a product page.
scCheckoutInitiatedCheckout InitiatedTriggered when a customer begins the checkout process.
scCheckoutCompletedCheckout CompletedTriggered when a customer successfully completes the checkout process and finalizes their purchase.
scShippingInfoAddedShipping Info AddedTriggered when a customer adds or updates their shipping information during checkout.
scPaymentInfoAddedPayment Info AddedTriggered when a customer adds or updates their payment information during checkout.
scTrialStartedTrial StartedTriggered when a customer starts a free trial for a subscription-based product.
scSubscriptionStartedSubscription StartedTriggered when a customer starts a paid subscription for a product.

Step 2: Set Up Your Analytics Platform

Each analytics platform will have a method for tracking events or actions on your site. For example:

  • Google Analytics: Through Google Tag Manager (GTM)
  • Facebook Pixel: By adding event listeners for user actions.
  • Fathom: Using their API to track specific user interactions.

Make sure your analytics platform is properly installed on your site, typically by embedding a tracking code snippet in the header of your WordPress site.

Step 3: Listen for SureCart Events

SureCart triggers several events when actions are performed by customers. You can use JavaScript event listeners to capture these events and send data to your preferred analytics platform.

For example, the following event listener captures when the checkout process is completed:

Javascript:

window.addEventListener('scCheckoutCompleted', function(e) {
   const checkoutData = e.detail; // Checkout data is available here.
   // Use the data to send to your analytics platform
});

Step 4: Send the Data to Your Analytics Platform

Once you capture the event, the next step is to send the relevant data to your analytics platform. This can vary depending on the platform you’re using:

  • For Facebook Pixel: You can use Facebook’s ‘fbq’ function to log the event:

Javascript:

fbq('track', 'Purchase', {
     value: checkoutData.total,
     currency: checkoutData.currency
  });
  • For Fathom: Use the Fathom API to log the event:

Javascript:

fathom.trackGoal('YOUR_GOAL_ID', checkoutData.total);
  • For custom analytics solutions: You may need to send an HTTP request or use their provided JavaScript API to send the data.

Step 5: Test and Verify

After setting up the event listeners and data-sending functions, perform actions on your SureCart store (like adding items to the cart or completing a purchase). Use your analytics platform’s dashboard or logs to verify that the events are tracked correctly.

Additional Tools for Integration

If you need more flexibility, consider the following options:

  • Webhooks: SureCart supports sending data via webhooks, allowing you to push event data to a variety of endpoints. You can configure webhooks in SureCart’s settings to notify your analytics solution when certain actions occur.
  • API Integrations: If your analytics platform provides an API, you can integrate it directly with SureCart using custom code. Make API calls from your store to log events and track actions.

Example: Custom JavaScript for Event Tracking

Here is a practical example of how to integrate a custom analytics platform by listening for SureCart events and sending data:

Javascript:

// Listening for the checkout completed event
window.addEventListener('scCheckoutCompleted', function(e) {
   const checkoutData = e.detail;

   // Example of sending data to a custom analytics platform
   fetch('https://analytics.yourplatform.com/track', {
     method: 'POST',
     headers: {
       'Content-Type': 'application/json',
     },
     body: JSON.stringify({
       event: 'Checkout Completed',
       total: checkoutData.total,
       currency: checkoutData.currency
     }),
   }).then(response => {
     console.log('Event tracked successfully:', response);
   }).catch(error => {
     console.error('Error tracking event:', error);
   });
});

In this example, we capture the ‘scCheckoutCompleted’ event and send a POST request to a custom analytics platform with relevant data like the total purchase amount and currency.

SureCart makes it easy to integrate with any analytics platform. By leveraging custom JavaScript and event listeners, you can capture essential user interactions and send them to your analytics solution of choice.

For more detailed tracking or custom requirements, consider working with a developer or using available SureCart webhooks to automate event tracking.

If you need help with specific integrations, check out SureCart’s Developer Documentation or consult the community for support.

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