One of Rebuy's most popular products is the Smart Cart, which adds upsell and promotional potential to Shopify.
If your store uses the Smart Cart here's a simple way to track who is interacting with the cart and, in conjunction with Littledata's Google Analytics tracking for Shopify, how this leads to purchasing.
Using the integration below you can move beyond Rebuy's own analytics to track interactions with the Smart Cart.
In Google Analytics you can use the events tracked to:
After added the script below to your store, you will see these useful events to Google Analytics:
Google Analytics Event Name | Action |
---|---|
rebuy_smartcart_shown | Smart Cart is shown / opened |
rebuy_smartcart_hidden | Smart Cart is hidden / closed |
rebuy_smartcart_item_increase | An item quantity has been increased |
rebuy_smartcart_item_decrease | An item quantity has been decreased |
rebuy_smartcart_item_removed | A customer removes an item from the Smart Cart |
rebuy_smartcart_switched_to_subscription | An item is switched to subscription |
rebuy_smartcart_switched_to_onetime | An item is switched to one-time |
Adds to Cart and Remove from Cart that happen outside of the Smart Cart are already tracked by Littledata tracking for Shopify.
You'll be able to see those events using a Google Analytics debugger on the browser:
You'll be able to see chat events in the realtime reports for testing, and under Reports > Engagement > Events within 24 hours.
If you want to see how many people who viewed the Smart Cart went on to purchase you can build a customer segment of those that have a rebuy_smartcart_shown
event and compare with those users which did not.
Or look at the volume of events received and whether a certain volume of messaging drives purchasing.
You'll need developer access to the Shopify theme to add this integration currently. Please get in touch if you need help implementing this.
You need to paste this script anywhere into the Shopify theme.liquid
file, or assets loaded from the theme. It listens for the Smart Cart events, and passes those events onto Google Analytics using the gtag
library.
If the gtag
library has not yet loaded the events will be queued until Google Analytics is ready.
<script>
const eventsToTrack = [
{ rebuy: "rebuy:smartcart.show", ga: "rebuy_smartcart_shown" },
{ rebuy: "rebuy:smartcart.hide", ga: "rebuy_smartcart_hidden" },
{
rebuy: "rebuy:smartcart.line-item-increase",
ga: "rebuy_smartcart_item_increase",
},
{
rebuy: "rebuy:smartcart.line-item-decrease",
ga: "rebuy_smartcart_item_decrease",
},
{
rebuy: "rebuy:smartcart.line-item-removed",
ga: "rebuy_smartcart_item_removed",
},
{
rebuy: "rebuy:smartcart.item-switch-to-subscription",
ga: "rebuy_smartcart_switched_to_subscription",
},
{
rebuy: "rebuy:smartcart.item-switch-to-one-time",
ga: "rebuy_smartcart_switched_to_onetime",
},
];
eventsToTrack.forEach(function (event) {
document.addEventListener(event.rebuy, function (props) {
let params = {};
const item = props?.detail?.item;
if (item) {
const { sku, product_id, variant_id, product_title } = item;
params = {
...params,
sku,
product_id,
variant_id,
product_title,
};
}
gtag && gtag("event", event.ga, params);
});
});
</script>