NikolayBezay

April recommendation event for Adoric(new)

Jan 15th, 2021
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.78 KB | None | 0 0
  1. <script>
  2.     (function() {
  3.     var checkingAddToCartButton = setInterval(function() {
  4.         var addToCartButton = document.querySelector('#addToCart_mob');
  5.         if (addToCartButton && adoric) {
  6.            clearInterval(checkingAddToCartButton);
  7.             onclickFunction = addToCartButton.getAttribute('onclick');
  8.             onclickFunction = onclickFunction.replace(/"/g, '').replace(/'/g, '');
  9.             onclickFunction = onclickFunction.split(',');
  10.             if (onclickFunction.length > 1) {
  11.                 var productId = onclickFunction[1];
  12.                 adoric.trigger("pageview",{type:"product", ids: productId});
  13.             }
  14.         }
  15.     }, 500);
  16.     setTimeout(function() {
  17.         clearInterval(checkingAddToCartButton);
  18.     }, 10000);
  19. })();
  20. </script>
Advertisement
Add Comment
Please, Sign In to add comment