Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- (function() {
- var MAXIMUM_WAITING_TIME = 15 * 1000;
- var ITERATION_TIME_STEP = 500;
- function sendAdoricProductEvent(productSKU) {
- adoric.trigger('pageview', {
- type: 'product',
- ids: productSKU
- });
- }
- var waitPageTriggerElement = setInterval(function() {
- var skuElement = document.querySelector('.value[itemprop="sku"]');
- if (skuElement && window.adoric) {
- clearInterval(waitPageTriggerElement);
- sendAdoricProductEvent(skuElement.textContent);
- }
- }, ITERATION_TIME_STEP);
- setTimeout(function() {
- clearInterval(waitPageTriggerElement);
- }, MAXIMUM_WAITING_TIME);
- if (window.location.href.indexOf('/cart') !== -1 && window.checkoutConfig && window.checkoutConfig.quoteItemData) {
- window.checkoutConfig.quoteItemData.forEach(function(item) {
- if (item.product && item.product.sku) {
- sendAdoricProductEvent(item.product.sku);
- }
- });
- }
- })();
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement