Installation Instructions
1. Script Tag & Initialization
Include the SDK script tags in your HTML, before the closing </head>
tag:
<script async src="https://live-sdk.terrific.live/analytics-sdk.min.js"></script>
β<script> window.TerrificAnalyticsConfig = { storeId: 'STORE_ID', eventsUrl: 'https://terrific.live/api/customer-shop-event' } </script>
Make sure to replace STORE_ID
with your Terrific store ID, you can get it from Terrific Team
2. Implement Events
Checkout Complete
Tracks when a customer completes their checkout process.
TerrificAnalytics.trackCheckoutCompleted({
totalPrice: 100, // Required: Total price of the checkout including taxes, shipping, etc.
subTotalPrice: 90, // Optional: Subtotal price before taxes and shipping
products: [
// Required: Array of products in the checkout
{
id: '123', // Required: Product ID
title: 'Product 1', // Required: Product title/name
price: 100, // Required: Product price
variantId: 'var_123', // Optional: Variant ID if applicable
sku: 'SKU123', // Optional: Product SKU
quantity: 1, // Required: Quantity purchased
},
],
});
Product Added to Cart
Tracks when a product is added to the shopping cart.
TerrificAnalytics.trackProductAddedToCart({
totalPrice: 100, // Optional: New cart total after adding the product
product: {
// Required: Product that was added
id: '123', // Required: Product ID
title: 'Product 1', // Required: Product title/name
price: 100, // Required: Product price
quantity: 1, // Required: Quantity added
variantId: 'var_123', // Optional: Variant ID if applicable
sku: 'SKU123', // Optional: Product SKU
},
});
Page Viewed
Tracks when a customer views any page on the site.
TerrificAnalytics.trackPageViewed({
url: 'https://www.example.com/product/123', // Required: URL of the viewed page
});
Product Removed from Cart
Tracks when a product is removed from the shopping cart.
TerrificAnalytics.trackProductRemovedFromCart({
totalPrice: 100, // Optional: New cart total after removing the product
product: {
// Required: Product that was removed
id: '123', // Required: Product ID
title: 'Product 1', // Required: Product title/name
quantity: 1, // Required: Quantity removed
price: 100, // Optional: Product price
variantId: 'var_123', // Optional: Variant ID if applicable
sku: 'SKU123', // Optional: Product SKU
},
});
β