We’ve had many clients connect our module to Google Analytics (GA). Depending on the version of GA you have, you may already detect our events. If not, our modules support event callbacks that can initiate events that are tracked in GA.
Note: This integration guide applies to both GA4 and GA360 versions. The implementation code and event callbacks work the same way for both versions. GA360 provides additional enterprise features like higher data limits and advanced reporting capabilities, but the technical integration remains identical.
Here’s an overview of how to use event callbacks for GA:
Event Handlers
Here are the event handlers that occur with the use of our module:
*onFinish* - FindMine JavaScript finished loading*onPreviousLook* - for multi-look widget displays, user went backwards in the look carousel*onNextLook* - for multi-look widget displays, user advanced the look carousel*onItemClick* - User clicked on a featured item in a lookNote: Some event handlers have an e parameter, which gives you access to the native browser event object. See the installation section for example code.
Installation
The snippet shown below highlights the event callbacks for FindMine widgets. Each callback is optional and independent from one another.
For the onFinish event handler, we’ve included a call to GA4 (gtag) with an event called fm-finish. This assumes you’ve already defined fm-finish as an event in GA4. In this example, 'Category', 'Label', and 'Value' are placeholders. You'll need to replace them with values that make sense for your tracking needs. The 'Value' is optional and should be an integer.
window.onload = **function**() {
window.FindMine.match({
// Placeholder product
application: '123',
product_id: 'YXZ',
return_pdp_item: **true**,
event_handlers: {
onItemClick: **function**(e){ // Call to GA },
onPreviousLook: **function**(e){ // Call to GA },
onNextLook: **function**(e){ // Call to GA },
onFinish: **function**(){
gtag('event', 'fm-finish', {
'event_category': 'Category',
'event_label': 'Label',
'value': '2'
});
}
}
});
};
You can use events like fm-finish as part of your overall funnel: for instance, to determine if your shopper viewed the FindMine widget and then added the product to cart and checked out. You could create other events tied to onItemClick that lets you understand if the shopper clicked on a Complete the Look item as part of their conversion journey.