Skip to content

Instantly share code, notes, and snippets.

@oddnavy
Last active July 20, 2020 23:42
Show Gist options
  • Save oddnavy/1667b20113fb7ba4f44489f3c55630e6 to your computer and use it in GitHub Desktop.
Save oddnavy/1667b20113fb7ba4f44489f3c55630e6 to your computer and use it in GitHub Desktop.
// ✅ Working
const trackViewProduct = async product => {
AppEventsLogger.logEvent('fb_mobile_content_view', {
fb_content_id: product.plu,
fb_content_type: 'product',
fb_currency: 'AUD',
});
};
// ✅ Working
const trackAddToCart = async orderItem => {
AppEventsLogger.logEvent('fb_mobile_add_to_cart', orderItem.totals.dollarValue, {
fb_content_id: orderItem.product.plu,
fb_content_type: 'product',
fb_currency: 'AUD',
});
};
// ❌ Not working
const trackBeginCheckout = async CartStore => {
// Event is logged
FacebookAppEventsLogger.logEvent('fb_mobile_initiated_checkout', CartStore.totalPrices.dollarValue);
// Event doesn’t seem to be logged within event manager if parameters included
AppEventsLogger.logEvent('fb_mobile_initiated_checkout', CartStore.totalPrices.dollarValue, {
fb_content: CartStore.orderItems.map(orderItem => ({
id: orderItem.product.plu,
quantity: orderItem.quantity,
})),
fb_content_type: 'product',
fb_currency: 'AUD',
});
};
// ✅ Working
const trackAddPaymentInfo = async () => {
await AppEventsLogger.logEvent('fb_mobile_add_payment_info');
};
// ❌ Not working
const trackPurchase = async CartStore => {
// Event is logged
FacebookAppEventsLogger.logPurchase(CartStore.totalPrices.dollarValue, CURRENCY);
// Event doesn’t seem to be logged within event manager if parameters included
AppEventsLogger.logPurchase(CartStore.totalPrices.dollarValue, 'AUD', {
fb_content: CartStore.orderItems.map(orderItem => ({
id: orderItem.product.plu,
quantity: orderItem.quantity,
})),
fb_content_type: 'product',
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment