NikolayBezay

Proxima custom coupon marker for Adoric.

Jan 27th, 2021
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.04 KB | None | 0 0
  1. <script>
  2. if (window.Element && !Element.prototype.closest) {
  3.  Element.prototype.closest =
  4.  function(s) {
  5.    var matches = (this.document || this.ownerDocument).querySelectorAll(s),
  6.        i,
  7.        el = this;
  8.     do {
  9.       i = matches.length;
  10.       while (--i >= 0 && matches.item(i) !== el) {};
  11.     } while ((i < 0) && (el = el.parentElement));
  12.    return el;
  13.  };
  14. }
  15.  
  16. (function () {
  17.    document.querySelector('body').addEventListener('click', function(event) {
  18.        var offerCard = event.target.closest('[data-component="offer-card"]');
  19.        var isUserSawAdoricCampaign = window.localStorage.getItem('adoricCouponesRedirect');
  20.        if (offerCard && isUserSawAdoricCampaign) {
  21.            window.localStorage.removeItem('adoricCouponesRedirect');
  22.            window.ga && window.ga('t0.send', 'event', {
  23.                eventCategory: 'Adoric - user add coupon',
  24.                eventAction: 'click',
  25.                eventLabel: 'User added coupon by Adoric campaign'
  26.            });
  27.        }
  28.    });
  29. })();
  30. </script>
Advertisement
Add Comment
Please, Sign In to add comment