Created
October 12, 2023 12:37
-
-
Save bougsid/11553a17a3805832bf880a9251f9aefc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.es_hook_purchase_success_func = (order) => { | |
//You can find the order object format here: https://shopify.dev/docs/api/admin-rest/2023-07/resources/order | |
if (typeof fbq === "function") { | |
let data = { | |
value: order.totalPrice, | |
num_items: order.itemCount, | |
currency: window.ShopifyAnalytics.meta.currency, | |
}; | |
data.content_ids = order.items?.map(item => item.product_id); | |
data.content_type = "product_group"; | |
window.fbq( | |
"track", | |
"Purchase", | |
data); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment