Where to find the Miappi Conversion Tracking Snippet?
The Miappi Conversion Tracking Snippet can be found in the Dashboard by:
Starting in your own Miappi profile
Navigate to the left-hand menu and select Analyze
Hover to the top-right hand corner of the page and select Conversion Tracking
Above that link in the top right-hand corner, click on the Conversion Snippet Code button
Conversion Tracking Events Automatically Tracked by Embed Code
You can set a “campaign” for the events by adding:
data-campaign-name=”...”
To the “miappi-frame” div at the point of embed.
The following events are automatically tracked by the Embed code.
Post Visible (Impression)
This is triggered when a post is shown in the Embed.
feed_post_visible
campaign (string) (optional)
post_id (string)
date (number)
Post Clicked (Engagement)
This is triggered when a user clicks on a post in the Embed.
feed_post_clicked
campaign (string) (optional)
post_id (string)
date (number)
Post CTA Clicked (Engagement)
This is triggered when a CTA for a Post is clicked.
feed_post_cta_clicked
campaign (string) (optional)
post_id (string)
product_id (string)
date (number)
Product Added to Cart (Action)
This is triggered when a user clicks on add to cart for a Post with an attached Shopify Product.
cart_added
campaign (string) (optional)
post_id (string) (optional)
product_id (string)
date (number)
qty (number)
price (float)
currency (string)
In addition to Miappi automatically tracking this event in the Embed, you can also track 'add to cart' events for Products outside the Embed and on the Shopify page by registering this event through the Miappi Conversion Tracking Snippet.
In Shopify, click 'Online Store' in the sidebar for your Store.
Click on 'Customize Theme' for your Theme.
Select 'Products' from the menu at the top of the page and the Product template
Find the “Custom Liquid” menu item and then add:
You will need the following button class-name for your add to cart button:
{ % comment % }
<!-- Miappi Tracking Code -->
{ % endcomment % }
[PASTE YOUR MIAPPI CONVERSION TRACKING SNIPPET HERE IF IT’S NOT ALREADY LOADED]
<script type="text/javascript">
var classname = document.getElementsByClassName('[ADD-TO-CART-BUTTON-CLASSNAME]');
var addToCart = function() {
window.mpitrk('event', 'cart_added', {
"campaign": "[CAMPAIGN-NAME]",
"product_id": "{{product.id}}",
"date": "{{'now'|date:"%s"|times:1000}}",
"price": "{{product.price}}"/100,
"currency": "{{shop.currency}}"
});
};
for (var i = 0; i < classname.length; i++) {
classname[i].addEventListener('click', addToCart, false);
}
</script>
{ % comment % }
<!-- End Miappi Tracking Code -->
{ % endcomment % }
Customer Tracked Events via the Conversion Tracking Snippet
Feed - Cart Checkout - Order
cart_checkout
order_id (string)
currency (string)
cart:[
{
product_id: (number)
price: (float)
qty:(number)
campaign:(string)
post_id: (number)
}
]
total: float
total_qty: number
date: number
Go To Admin -> Settings -> Checkout and accounts
And paste the code in Order status page -> Additional scripts
{ % comment % }
<!-- Miappi Tracking Code -->
{ % endcomment % }
[PASTE YOUR MIAPPI CONVERSION TRACKING SNIPPET HERE IF IT’S NOT ALREADY LOADED]
<script type = "text/javascript" >
if (Shopify.Checkout.step == 'thank_you') {
window.mpitrk('event', 'cart_checkout', {
"order_id" :"{{order_number}}",
"currency" :"{{shop.currency}}",
"cart": [
{% for line_item in line_items %}
{
"product_id":{{ line_item.product_id }},
"price":{{line_item.line_price|money_without_currency}},
"qty":{{line_item.quantity}},
"campaign":"{{line_item.properties.campaign}}",
"post_id":"{{line_item.properties._post_id}}"
}
{% unless forloop.last %},{% else %}{% endunless %}{% endfor %}
],
"total": "{{subtotal_price | money_without_currency }}",
"total_qty":"{{item_count}}",
"date": "{{'now'|date:"%s"|times:1000}}",
});
}
</script>
{ % comment % }
<!-- End Miappi Tracking Code -->
{ % endcomment % }
If you have any questions regarding your Miappi Conversion Tracking Pixel, please get in touch using info@miappi.com.