Facebook Pixel

Mobi2Go can implement the Facebook Pixel and perform conversion tracking using events raised by our Analytics API.

In order to do this, you'll need to supply us with your Facebook Pixel id.

Once we implement the Facebook Pixel for your site, if you'd like to view the events being raised on your site in the browser to check how it works, we suggest using the Facebook Pixel Helper, a extension that Facebook make available for the Chrome browser.

The events we make available are mostly those standard events described on our Analytics API page mapped on to many of the events that are described on the Facebook Pixel conversion tracking page, along with a number of extra custom events.

Standard Facebook Pixel events

// When the page is loaded
fbq('track', 'PageView');

// When a store is selected
fbq('track', 'FindLocation', {
    location_name: location.name
});

// When a product is added to the cart
fbq('track', 'AddToCart', {
    content_ids: [content_id],
    content_name: product.menu_product.name,
    content_type: 'product',
    currency: Mobi2Go.headoffice.currency_abrv,
    value: product.price[0]
});

// When a user clicks the 'Next step' button to start checkout
fbq('track', 'InitiateCheckout', {
    content_ids: content_ids,
    currency: Mobi2Go.headoffice.currency_abrv,
    value: Order.getTotal().getTaxExclusivePrice().toFloat(),
    contents: contents
});

// When the order is confirmed (paid for)
fbq('track', 'Purchase', {
    content_ids: content_ids,
    content_type: 'product',
    currency: Mobi2Go.headoffice.currency_abrv,
    value: order.getTotal().getTaxExclusivePrice().toFloat(),
    contents: contents,
    tax: order.getTotal().getTaxPrice().toFloat(),
    shipping: order.getDeliveryFee().toFloat(),
    coupon: order.getVoucherCode()
});

// When a user has completed registration
fbq('track', 'CompleteRegistration', {});

Custom Facebook Pixel events

fbq('trackCustom', 'country', {
    country_iso: Mobi2Go.headoffice.country_iso3166_alpha2
});

fbq('trackCustom', 'platform', {
    platform: Mobi2Go.app.getPlatform()
});

// When the last order is loaded
fbq('trackCustom', 'LoadLastOrder', {
    last_order_id: last_order_state.id
});

// When a customer has logged in
fbq('trackCustom', 'IdentifyUser', {
    customer_id: customer.id
});

// When the product menu is viewed
fbq('trackCustom', 'ViewMenu', {
    menu_name: menu.name,
    content_ids: content_ids
});

// When a product menu category is viewed
fbq('trackCustom', 'ViewCategory', {
    content_category: category.name,
    content_ids: content_ids
});

// When a product is in the cart is edited
fbq('trackCustom', 'EditProduct', {
    product_name: product.menu_product.name,
    content_ids: [content_id],
});

// When a product is in the cart is removed
fbq('trackCustom', 'RemoveProduct', {
    product_name: product.menu_product.name,
    content_ids: [content_id],
});

// When a user clicks the 'Pay Now' button
fbq('trackCustom', 'StartPayment', {
    order_id: order.getId()
});

// When the credit card details are saved after order confirmation
fbq('trackCustom', 'SaveCreditCard', {});
Have more questions? Submit a request

Comments