Forked from clientlab-dev/E-commerce - Покупка в один клик
Created
November 2, 2020 02:47
-
-
Save Shoora/ecf1d2f51f715293203a1bd13b92bf81 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
<script> | |
try{ | |
//window.dataLayer = window.dataLayer || []; | |
dataLayer.push({ | |
'ecommerce': { | |
'purchase': { | |
'actionField': { | |
'id': $('.modal-container').text().match(/\d+/g)[0]*1, // Transaction ID. Required for purchases and refunds. | |
'revenue': currentPrice * productQuantity, // Total transaction value (incl. tax and shipping) | |
}, | |
'products': [{ | |
brand: "", | |
category: "", | |
id: productId, | |
name: productName, | |
price: currentPrice, | |
quantity: productQuantity, | |
variant: "" | |
}] | |
} | |
} | |
}); | |
dataLayer.push({'event': 'purchase'}); | |
yaCounter16150147.reachGoal('ONE_CLICK_ORDER'); | |
console.log('ya_goal','ONE_CLICK_ORDER'); | |
}catch(e){ | |
console.log('e', e); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment