(function (d, w) { // eslint-disable-line max-statements function imgSrcToElement(src) { var img = d.createElement('img'); img.height = 1; img.width = 1; img.style.display = 'none'; img.src = src; img.alt = ''; return d.body.appendChild(img); } function iframeSrcToElement(src) { var ifrm = d.createElement('iframe'); ifrm.width = 1; ifrm.height = 1; ifrm.style.display = 'none'; ifrm.src = src; return d.body.appendChild(ifrm); } function scriptSrcToElement(src, async) { var isAsync = async === null ? true : async; var script = d.createElement('script'); script.type = 'text/javascript'; script.src = src; script.async = isAsync; return d.body.appendChild(script); } function dropPixel(src, type) { if (type === 'img') { return imgSrcToElement(src); } if (type === 'script') { return scriptSrcToElement(src); } if (type === 'iframe') { return iframeSrcToElement(src); } return false; } var aupixels = { // eslint-disable-line no-implicit-globals, no-unused-vars pageload: [ ], linkfire: { // INSERT LINKFIRE PIXELS HERE /* ex: 'itunes': [ ['https://secure.adnxs.com/px?id=911725&t=2&adgt=true', 'img'], ['https://ad.doubleclick.net/ddm/activity/src=8005553;type=invmedia;cat=hs0rirok;dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;ord=1?', 'img'], ], 'google-play': [ ['https://secure.adnxs.com/px?id=911726&t=2&adgt=true', 'img'], 'https://ad.doubleclick.net/ddm/activity/src=8005553;type=invmedia;cat=bphkhwr5;dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;ord=1?' ], */ // END LINKFIRE PIXELS HERE }, ec: { // INSERT ECOMMERCE PIXELS HERE /* ex: 'view': [ ['https://secure.adnxs.com/px?id=911725&t=2&adgt=true', 'img'], ['https://ad.doubleclick.net/ddm/activity/src=8005553;type=invmedia;cat=hs0rirok;dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;ord=1?' ], 'add': [ ['https://secure.adnxs.com/px?id=911725&t=2&adgt=true', 'img'], ['https://ad.doubleclick.net/ddm/activity/src=8005553;type=invmedia;cat=hs0rirok;dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;ord=1?', 'img'], ], 'checkout': [ ['https://secure.adnxs.com/px?id=911725&t=2&adgt=true', 'img'], ['https://ad.doubleclick.net/ddm/activity/src=8005553;type=invmedia;cat=hs0rirok;dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;ord=1?', 'img'], ], 'transaction': [ ['https://secure.adnxs.com/px?id=911725&t=2&adgt=true', 'img'], ['https://ad.doubleclick.net/ddm/activity/src=8005553;type=invmedia;cat=hs0rirok;dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;ord=1?', 'img'], ] */ }, buttonClickPixels: [ // INSERT CUSTOM BUTTON CLICK PIXELS HERE // for adding custom button click pixels unique to one or very few sites/campaigns. if more common implementation, use profiler service // example: // { // selector: 'SOME querySelectorAll-STYLE SELECTOR', // pixels: [['pixel-1-src', 'img|script|iframe'], ['pixel-2-src', 'img|script|iframe']], // }, ], }; // const { linkfire, ec, buttonClickPixels } = aupixels; // w.aupixels = { linkfire, ec }; // // aupixels.pageload.forEach(item => dropPixel(item[0], item[1])); var linkfire = aupixels.linkfire; var ec = aupixels.ec; w.aupixels = { linkfire: linkfire, ec: ec }; var buttonClickPixels = aupixels.buttonClickPixels; aupixels.pageload.forEach(function(item) { dropPixel(item[0], item[1]); }); function createEvent() { if (typeof window.CustomEvent === 'function') { return new CustomEvent('aupixels'); // eslint-disable-line } var p = { bubbles: false, cancelable: false, detail: undefined // eslint-disable-line }; var evt = document.createEvent('CustomEvent'); // eslint-disable-line evt.initCustomEvent('aupixels', p.bubbles, p.cancelable, p.detail); return evt } function buttonClickHandlers(selectors) { selectors.forEach(function(e) { // eslint-disable-line var selector = e.selector; // eslint-disable-line var pix = e.pixels; var els = d.querySelectorAll(selector); for (var i = 0; i < els.length; i++) { // eslint-disable-line var button = els[i]; pix.forEach(function(item) { // eslint-disable-line button.addEventListener('mousedown', function() { // eslint-disable-line dropPixel(item[0], item[1]); }); button.addEventListener('touchstart', function() { // eslint-disable-line dropPixel(item[0], item[1]); }); }) } }); } buttonClickHandlers(buttonClickPixels); // eslint-disable-line no-undef var event = createEvent(); w.dispatchEvent(event); })(document, window);