Did you find this summary helpful?
Thank you for your feedback
All possible events and payloads that can be tracked in Shoplive Shortform can be found in the link below.
addShortformEventListener
Enter the code below where you want to track events.
<script type="text/javascript" src="https://static.shoplive.cloud/shoplive-shortform.js"></script>
<script>
// Initialize
cloud.shoplive.initShortform({ accessKey: 'YOUR ACCESS KEY HERE' });
// Shortform event listener
const listener = (message, payload) => {
switch(message) {
case 'COLLECTION_CLICK_ITEM':
console.log("User clicks collection items : ", payload);
break;
case 'DETAIL_CLICK_PRODUCT_CARD':
console.log("User clicks product card item : ", payload);
break;
}
}
// Add event listener
cloud.shoplive.addShortformEventListener(listener);
</script>
removeShortformEventListener
Remove the listener that is tracking the event.
<script>
// shortform event listener
const listener = (message, payload) => {
console.log('shortform event listener', message, payload);
}
// remove event listener
cloud.shoplive.removeShortformEventListener(listener);
</script>