Vendo automatically listens for and tracks all custom events sent through Shopify's Web Pixel API. This allows you to send custom events to Mixpanel seamlessly without adding Mixpanel-specific code on the client side.
For each event received, Vendo automatically updates the following user properties for every event, so you don’t need to send them manually:
distinct_id
$device_id
$insert_id
$current_url
page_title
path_name
$browser
$device
$os
+ UTM's & Click IDs
Below are some examples to help you get started:
1. Sending Events with Event Properties
You can use the following code to send custom events with properties:
<script>
Shopify.analytics.publish('replace_with_event_name', {
'replace_property_name': "property_value"
});
</script>
Replace 'replace_with_event_name' and 'replace_property_name' with your event and property names.
2. Identifying Users
You can also identify users by sending their User IDs. Here’s an example:
<script>
Shopify.analytics.publish('replace_with_event_name', {
'property_name': "xxx",
'$user_id': '6807172218927' // Pass the Shopify Customer ID to identify the user in Mixpanel
});
</script>
Make sure to use the Shopify Customer ID as the $user_id. This will allow Mixpanel to identify the user.
3. Changing the Tracking Source
By default, the tracking source is set to Vendo - Shopify App
. To customize this, you can add the $source parameter:
<script>
Shopify.analytics.publish('replace_with_event_name', {
'property_name': "xxx",
'$user_id': '6807172218927', // Shopify Customer ID
'$source': 'my_custom_source' // Replace the default source with a custom one
});
</script>
The $source property will override the default tracking source to help you distinguish event origins.