(function() { function bxBootstrap() { var re = /bot|crawl|slurp|spider|mediapartners|headlesschrome|snap-prefetch|remotasks|woorank|uptime\.com|facebookexternalhit|facebookcatalog/i; if (re.test(navigator.userAgent) || navigator.userAgent == '') { return; } if (!(window.bouncex&&bouncex.website)) { var pushedData = []; if(window.bouncex && bouncex.push && bouncex.length){ pushedData = bouncex; } window.bouncex = {}; bouncex.pushedData = pushedData; bouncex.website = {"id":1990,"name":"Conde Nast - New Yorker","cookie_name":"bounceClientVisit1990","domain":"newyorker.com","ct":"bind_to_domain","ally":0,"ei":0,"tcjs":"try {\n /* used for ibx eligibility -SK */\n\tvar subscriptionText = jQuery('.main_order_summary .top_part_summary').find('div:contains(Plan)').text();\n\tvar subscriptionType = (subscriptionText.split(':')[1] || '').trim().toLowerCase();\n\tbouncex.push(['subscribe', {\n\t\ttype: subscriptionType,\n\t\tid: HEARST.circ.campaignId\n\t}]);\n} catch(e) {\n\tbouncex.err(e);\n}","cjs":"//Omniture Link track\nwindow.bouncex.bxLinkTrack = function(label, event) {\n\ttry {\n event = event || false;\n if (event) {\n window.s.linkTrackEvents = event;\n window.s.events = event;\n }\n\t\twindow.s.linkTrackVars = 'eVar10,events';\n\t\twindow.s.eVar10 = label;\n\t\twindow.s.tl(true,'o',label);\n\t\twindow.s.linkTrackEvents = undefined;\n\t\twindow.s.linkTrackVars = undefined;\n\t\twindow.s.events = undefined;\n\t\twindow.s.eVar10 = undefined;\n\t} catch (e) {\n\t\tconsole.log(e);\n\t}\n};\n\n\n\n// PD: https://www.wrike.com/open.htm?id=322595888\nbouncex.report_ga = function(action, label, bypass) {\n var parsedAction = action.replace(/[a-z]/, function(letter) { return letter.toUpperCase(); });\n if (window.dataLayer) {\n window.dataLayer.push({'event': 'BounceX '+parsedAction, 'bouncex-action':label});\n }\n};\n\nif (bouncex.website.pts === 'article') {\n bouncex.et.onVarChange('registration_wall', function(){\n if (bouncex.vars.registration_wall) {\n bouncex.setVar('reg_gate_url', window.location.pathname);\n }\n });\n \n if (bouncex.vars.reg_gate_url === window.location.pathname && !bouncex.vars.registration_wall) {\n bouncex.setVarAndReload('reg_gate_suppression', true);\n }\n }\n/* enable.feature.DISABLE_RELOAD_CAMPAIGNS_V2 */\n/* enable.feature.TCF_ENABLE_NEW_PURPOSE_LIST */\n\nbouncex.setVar('test_prioritization', Math.floor(Math.random() * 100) + 1);","force_https":false,"waypoints":false,"content_width":0,"gai":"","swids":"","sd":0,"ljq":"auto","campaign_id":0,"is_preview":false,"aco":{"first_party_limit":"3500","local_storage":"1"},"cmp":{"gdpr":1,"gmp":0,"whitelist_check":0},"burls":[{"prop":"contains","val":"/about/therightquestion"},{"prop":"contains","val":"https://www.newyorker.com/news/a-reporter-at-large/china-xinjiang-prison-state-uighur-detention-camps-prisoner-testimony"},{"prop":"contains","val":"/subscribe/newyorker/138056"},{"prop":"contains","val":"/subscribe/newyorker/138075"},{"prop":"contains","val":"/subscribe/newyorker/138085"},{"prop":"contains","val":"/about/app-faq"},{"prop":"contains","val":"/about/faq"},{"prop":"contains","val":"/the-secretive-libyan-prisons-that-keep-migrants-out-of-europe"},{"prop":"contains","val":"paid-revops"}],"ple":false,"fbe":false,"mas":2,"map":1,"gar":true,"ete":0,"ettm":true,"etjs":"","dge":false,"bxidLoadFirst":false,"pie":false,"cme":false,"gbi_enabled":0,"bpush":false,"pt":{"article":{"testmode":false,"val":[[{"activation":"js","prop":"","prop2":"","prop3":"","val":"document.querySelectorAll('.page-article,#articleBody,#article-content,.page--article').length > 0 && window.location.pathname.indexOf( '/about') !== 0 && window.location.pathname !== \"/newsletters\";"}]]},"category":{"testmode":false,"val":[[{"activation":"js","prop":"","prop2":"","prop3":"","val":"(document.querySelectorAll('.page-index,.page-collection,.page-magazine,.grid-item,div[class*=\"HubHeader__\"]').length > 0 && window.location.pathname.indexOf('/about') !== 0 && window.location.pathname !== \"/cartoons\") || [\"/archive\", \"/goings-on-about-town/\", \"/goings-on-about-town\", \"/goings-on-about-town/movies\", \"/video\"].indexOf(window.location.pathname) > -1 && window.location.href.indexOf(\"/newsletters\") == -1;\n\n\n\n"}]]},"gallery":{"testmode":false,"val":[[{"activation":"js","prop":"","prop2":"","prop3":"","val":"[\"/cartoons/random/\",\"/cartoons\"].indexOf(window.location.pathname) > -1;"}]]},"home":{"testmode":false,"val":[[{"activation":"js","prop":"","prop2":"","prop3":"","val":"window.location.pathname === \"/\" ;"}]]},"search":{"testmode":false,"val":[[{"activation":"js","prop":"","prop2":"","prop3":"","val":"window.location.pathname.indexOf( '/search') > -1;"}]]}},"els":{"endcap":".recirc-list-wrapper.viewport-monitor-anchor","infeed":"article p+p, article p+.bxc+p","masthead":"#cns-ads-slot-type-header-0, .page--article .ad--out-of-page"},"vars":[{"name":"logged_in","polling":"all","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"(function() {\r\n\tif (window.location.pathname.indexOf('goings-on-about-town') > -1) {\r\n\t\treturn null;\r\n\t} else if (window.location.pathname.indexOf('digital-editions') > -1) {\r\n\t\treturn null;\r\n\t} else if (window.location.pathname.indexOf('myaccount/profile') > -1) {\r\n\t\treturn document.querySelectorAll('.logged-in').length > 0;\r\n\t} else {\r\n\t\treturn document.querySelectorAll('.account-links__sign-out').length > 0;\r\n\t}\r\n})();","trigger":""},{"name":"logged_in_subscriber","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"(function() {\n var isSubscribed = ['renew', 'give a gift'],\n btnText = jQuery('.nav-cta__anchor').text().toLowerCase();\n return isSubscribed.indexOf(btnText) > 0;\n})();","trigger":"pageload"},{"name":"submitted_email_daily","polling":"all","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"(function(){\n\tvar cookieName = 'atp_newsletter';\n\tvar findCookie = document.cookie.match('(^|;)\\\\s*' + cookieName + '\\\\s*=\\\\s*([^;]+)');\n var CookieContents = findCookie ? findCookie.pop() : '';\n \tvar newsletterValues = CookieContents !== \"\" ? JSON.parse(CookieContents ) : false;\n\n \tfor(var i = 0; i < newsletterValues.length; i++){\n \t\tif(newsletterValues[i] === '217'){\n \t\t\treturn true;\n \t\t}\n \t}\n \treturn null;\n})();","trigger":""},{"name":"submitted_email_politics","polling":"all","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"null","trigger":""},{"name":"submitted_email_food","polling":"all","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"null","trigger":""},{"name":"submitted_email_cartoon","polling":"all","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"(function(){\n\tvar cookieName = 'atp_newsletter';\n\tvar findCookie = document.cookie.match('(^|;)\\\\s*' + cookieName + '\\\\s*=\\\\s*([^;]+)');\n var CookieContents = findCookie ? findCookie.pop() : '';\n \t\tvar newsletterValues = CookieContents !== \"\" ? JSON.parse(CookieContents ) : false;\n\n \tfor(var i = 0; i < newsletterValues.length; i++){\n \t\tif(newsletterValues[i] === '442'){\n \t\t\treturn true;\n \t\t}\n \t}\n\n \treturn null;\n})();","trigger":""},{"name":"submitted_email_podcasts","polling":"all","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"(function(){\n\tvar cookieName = 'atp_newsletter';\n\tvar findCookie = document.cookie.match('(^|;)\\\\s*' + cookieName + '\\\\s*=\\\\s*([^;]+)');\n var CookieContents = findCookie ? findCookie.pop() : '';\n \t \tvar newsletterValues = CookieContents !== \"\" ? JSON.parse(CookieContents ) : false;\n\n\n \tfor(var i = 0; i < newsletterValues.length; i++){\n \t\tif(newsletterValues[i] === '248755'){\n \t\t\treturn true;\n \t\t}\n \t}\n\n \treturn null;\n})();","trigger":""},{"name":"submitted_email_cassidy","polling":"all","persist":"permanent","page_types":[],"testmode":false,"default":0,"code":"(function(){\n\tvar cookieName = 'atp_newsletter';\n\tvar findCookie = document.cookie.match('(^|;)\\\\s*' + cookieName + '\\\\s*=\\\\s*([^;]+)');\n var CookieContents = findCookie ? findCookie.pop() : '';\n \tvar newsletterValues = CookieContents !== \"\" ? JSON.parse(CookieContents ) : false;\n\n \tfor(var i = 0; i < newsletterValues.length; i++){\n \t\tif(newsletterValues[i] === '248723'){\n \t\t\treturn true;\n \t\t}\n \t}\n\n \treturn null;\n})();","trigger":""},{"name":"submitted_email_humor","polling":"all","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"(function(){\n\tvar cookieName = 'atp_newsletter';\n\tvar findCookie = document.cookie.match('(^|;)\\\\s*' + cookieName + '\\\\s*=\\\\s*([^;]+)');\n var CookieContents = findCookie ? findCookie.pop() : '';\n \tvar newsletterValues = CookieContents !== \"\" ? JSON.parse(CookieContents ) : false;\n\n \tfor(var i = 0; i < newsletterValues.length; i++){\n \t\tif(newsletterValues[i] === '5129'){\n \t\t\treturn true;\n \t\t}\n \t}\n \treturn null;\n})();","trigger":""},{"name":"half_paywall_met","polling":"all","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"jQuery('.paywall-modal:visible').find('.paywall-bar-barrier-rtb--container:visible').length > 0 ? true : null;","trigger":""},{"name":"full_paywall_met","polling":"all","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"jQuery('#paywall:visible').find('[data-cns=cns-slot-full-barrier]').length > 0 ? true : null;","trigger":""},{"name":"article_count","polling":"none","persist":"visit","page_types":[],"testmode":false,"default":"0","code":"(function() {\n if (window.EVOLOK && EVOLOK.activeMeter && EVOLOK.activeMeter.count){\n return parseInt(EVOLOK.activeMeter.count);\n }\n else if (TNY && TNY.meterVar && TNY.meterVar.meter_count !== '') {\n return parseInt(TNY.meterVar.meter_count);\n } else {\n return null;\n }\n\n})();","trigger":""},{"name":"sub_type","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"","code":"(function() {\n if (window.location.href.indexOf('ibx_source') > 0) {\n var subtype = bouncex.ibx._getparam('bxplan');\n jQuery('#' + subtype + '_offer').click();\n } \n})();","trigger":""},{"name":"ibx_test","polling":"none","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"window.location.href.indexOf('ibx_test') > -1 || null","trigger":""},{"name":"author_name","polling":"all","persist":"no","page_types":["article"],"testmode":false,"default":"","code":"bouncex.utils.gtmLookup('content').contributor;","trigger":""},{"name":"sign_in_modal","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"(function() {\n var $signInModal = jQuery('#signin-view');\n \n if ($signInModal.length > 0) {\n return $signInModal.hasClass('fadeIn');\n }\n})();","trigger":""},{"name":"subscription_modal","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"jQuery('#link-subscription-modal:visible').length > 0;","trigger":""},{"name":"half_paywall","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"jQuery('[class*=\"PaywallBarWrapper\"] .paywall-bar--expanded').length > 0;","trigger":""},{"name":"full_paywall","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"jQuery('.paywall-modal-container .full-barrier-container').length > 0;","trigger":""},{"name":"article_page","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"bouncex.website.pts === \"article\";","trigger":""},{"name":"load_perf","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"","code":"/*namik:testing*/\n(function(){\n if(typeof performance != 'undefined' && performance.timing && performance.timing.navigationStart){\n\t\t\treturn (getTimeMs()-performance.timing.navigationStart);\n\t\t} else {\n\t\t\treturn -1;\n\t\t}})();","trigger":""},{"name":"growler_present","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"jQuery('[data-slot-type=\"modal\"]').find('.cns-ads-container:visible').length > 0 && jQuery('[data-slot-type=\"modal\"]').find('.cns-ads-container:visible').outerHeight() > 0","trigger":""},{"name":"mobile_paywall_modal","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"jQuery('[class^=MobileHeader]:visible').length > 0 ? jQuery('#paywall [data-cm-unit=\"show-failsafe\"]').length > 0 || (jQuery('iframe[id^=google_ads_iframe]').contents()[0] && jQuery('iframe[id^=google_ads_iframe]').contents()[0].querySelectorAll('#paywall').length > 0) : false;","trigger":""},{"name":"ever_logged_in","polling":"all","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"bouncex.vars.logged_in || null;","trigger":""},{"name":"cart","polling":"none","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":""},{"name":"viewed_popular","polling":"all","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"null; /* modified by campaigns using parsely i.e. 442987 */","trigger":""},{"name":"login_reported","polling":"none","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":""},{"name":"recommended_stories","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"bouncex.vars.article_page && window.__TNY__ && __TNY__.INITIAL_STATE && __TNY__.INITIAL_STATE.primary && __TNY__.INITIAL_STATE.primary.related && __TNY__.INITIAL_STATE.primary.related.relatedList && __TNY__.INITIAL_STATE.primary.related.relatedList.length > 0;","trigger":""},{"name":"using_edge_browser","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"bouncex.browser.edge","trigger":""},{"name":"submitted_email_culture","polling":"none","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"/* This is being set in Submission JS of campaigns */\nnull;","trigger":"pageload"},{"name":"submitted_email_borowitz","polling":"none","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"/* This is being set in Submission JS of campaigns */\nnull;","trigger":"pageload"},{"name":"submitted_email_crosswords","polling":"none","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"/* This is being set in Submission JS of campaigns */\nnull;","trigger":"pageload"},{"name":"dfp_rblock","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"(function() {\n if (!bouncex.dfpRan) {\n bouncex.dfpRan = true;\n return 'not_ready';\n }\n function check() {\n bouncex.dfp_loaded = false || bouncex.dfp_loaded;\n \n var event = bouncex.gbi2.getDfpEndPageViewEvent();\n \n if (event && event.dfp_status) {\n if (event.dfp_status == 'pending') {\n return 'not_ready';\n } \n \n bouncex.dfp_loaded = true;\n\n if (event.dfp_status == 'suppressed') {\n return 'sponsor';\n }\n\n return 'allow';\n }\n\n return 'not_ready';\n }\n\n if (bouncex.website.gbi.rblocks) {\n if (bouncex.dfp_loaded) {\n return null;\n } else if (window.googletag && googletag.apiReady && googletag.pubadsReady && bouncex.gbi2) {\n return check();\n } else if (typeof window.googletag === 'undefined') {\n return 'no_googletag';\n }\n return 'fallback';\n } else {\n return 'not_ready';\n }\n})()","trigger":"pageload"},{"name":"article_category","polling":"all","persist":"no","page_types":["article"],"testmode":false,"default":"false","code":"bouncex.website.pts === 'article' ? jQuery('span[class*=\"RubricName\"]:first').text().trim() : false;","trigger":"pageload"},{"name":"ad_blocker_campaign","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"jQuery('.AdBlockBarrier__barrier___3pC-h').length > 0;","trigger":"pageload"},{"name":"privacy_popup_visible","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"document.querySelectorAll('iframe#privacy-policy-user-agreement-popup').length > 0;","trigger":"pageload"},{"name":"cn_email_subscriber","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"bouncex.utils.cookies.read('CN_segments') && bouncex.utils.cookies.read('CN_segments').indexOf('en.nl') > -1;","trigger":"pageload"},{"name":"cn_site_subscriber","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"bouncex.utils.cookies.read('CN_segments') && (bouncex.utils.cookies.read('CN_segments').indexOf('en.nyr.a') > -1 || bouncex.utils.cookies.read('CN_segments').indexOf('en.tny.a') > -1 || bouncex.utils.cookies.read('CN_segments').indexOf('en.ny3.a') > -1);","trigger":"pageload"},{"name":"topbar_visible","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"jQuery('.bx-type-nanobar.bx-impress').is(':visible');","trigger":"pageload"},{"name":"bottombar_visible","polling":"all","persist":"no","page_types":[],"testmode":true,"default":"false","code":"// jQuery('.bx-type-conversionbar.bx-impress').is(':visible');","trigger":"pageload"},{"name":"aiq_segment","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"bouncex.utils.cookies.read('CN_segments');","trigger":"pageload"},{"name":"order_form","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"(function(){\n\tvar str = bouncex.utils.getNestedProp('circ.campaignName', '', HEARST).toLowerCase();\n\tvar badMatches = str.match(/remail|_dm/g);\n\t\n\tif (!!badMatches) return false;\n\n if (str.includes('_nat_')) {\n return '_nat_';\n } else if (str.includes('eml')) {\n return '_eml_';\n } else if (str.includes('email')) {\n return '_eml_';\n } else {\n return false;\n }\n})();","trigger":"pageload"},{"name":"article_keywords","polling":"none","persist":"no","page_types":["article"],"testmode":false,"default":"false","code":"document.head.querySelector(\"[name=keywords\").content;","trigger":"pageload"},{"name":"sign_in_paywall","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"jQuery('.paywall-modal-container:visible').length > 0;","trigger":"pageload"},{"name":"registration_wall","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"jQuery('.reg-gate-bar__container').length > 0;","trigger":"pageload"},{"name":"reg_gate_submitted","polling":"all","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"jQuery('.paywall-bar__screen--sign-in:visible').length > 0 || null;","trigger":"pageload"},{"name":"reg_gate_suppression","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"reg_gate_url","polling":"all","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"after_reg_gate","polling":"all","persist":"no","page_types":[],"testmode":true,"default":"false","code":"null;","trigger":"pageload"},{"name":"fb_news","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"(bouncex.getBounceCookie('CN_segments') || '').indexOf('fbnews.tny') > -1;","trigger":"pageload"},{"name":"hard_paywall_present","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"jQuery('.paywall-modal-container').length > 0 || jQuery('.paywall-bar-barrier-rtb--container').length > 0;","trigger":"pageload"},{"name":"user_bucket","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"localStorage.getItem('usr_bkt_eva') && Number(localStorage.getItem('usr_bkt_eva')) <= 48 ? 'panel A' : Number(localStorage.getItem('usr_bkt_eva')) <= 96 ? 'panel B' : null;","trigger":"pageload"},{"name":"barrier_timestamp","polling":"none","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"barrier_seen_month","polling":"all","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"(function () {\n var currentTimestamp = new Date().getTime(),\n firstDayOfMonth = new Date(new Date().getFullYear(), new Date().getMonth(), 1).getTime();\n \n /* if the last paywall timestamp is before the first day of the month and it is the first day of the month set timestamp to null - to reset seen-this-month */\n if (bouncex.vars.half_paywall_met) {\n bouncex.setVar('barrier_timestamp', currentTimestamp);\n }\n \n if ((bouncex.vars.barrier_timestamp < firstDayOfMonth)&&(bouncex.vars.barrier_timestamp !== false)) {\n bouncex.setVar('barrier_timestamp', null);\n return false\n }\n if (bouncex.vars.barrier_timestamp) {\n return true;\n }\n \n return null;\n})();","trigger":"pageload"},{"name":"barrier_seen_month_overlay","polling":"all","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"(function () {\n var currentTimestamp = new Date().getTime(),\n firstDayOfMonth = new Date(new Date().getFullYear(), new Date().getMonth(), 1).getTime();\n \n /* if the last paywall timestamp is before the first day of the month and it is the first day of the month set timestamp to null - to reset seen-this-month */\n if (bouncex.vars.hard_paywall_present) {\n bouncex.setVar('barrier_timestamp', currentTimestamp);\n }\n \n if ((bouncex.vars.barrier_timestamp < firstDayOfMonth)&&(bouncex.vars.barrier_timestamp !== false)) {\n bouncex.setVar('barrier_timestamp', null);\n return false\n }\n if (bouncex.vars.barrier_timestamp) {\n return true;\n }\n \n return null;\n})();","trigger":"pageload"},{"name":"ecap_fired_pageview","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"article_title","polling":"none","persist":"no","page_types":[],"testmode":true,"default":"false","code":"document.querySelectorAll('h1[data-testid=\"ContentHeaderHed\"]').length ? document.querySelectorAll('h1[data-testid=\"ContentHeaderHed\"]')[0].innerText : false;","trigger":"pageload"},{"name":"journey_site_subscriber","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"(() => {\n // Array/list of brand product names.\n // Manually update according to the brand.\n // If a brand has no product names, default to the brand name.\n const brandProductNames = [\"newyorker\", \"tny\"];\n /**\n * Reads the CN Access token and checks if there is an active web product.\n * @param {string} cnAccessToken - CN Access Token.\n * @returns {boolean} - has the user an active web product for the brand.\n */\n function determineAccessEntitlement(cnAccessToken) {\n if (!cnAccessToken) return false;\n const decodedToken = JSON.parse(atob(cnAccessToken.split(\".\")[1]));\n const rgx = new RegExp(`(${brandProductNames.join(\"|\")})(:web|\\.com)`, \"i\");\n return Object.values(decodedToken.fct || {})\n .flat()\n .some((product) => product.match(rgx));\n }\n /**\n * Gets user entitlement and authentication status for a brand.\n * Wunderkind script to target user status in their campaigns.\n * @returns {object} - { isEntitled, isLoggedIn }\n */\n function getUserStatus() {\n let isEntitled = false;\n let isLoggedIn = false;\n try {\n const entitlementCookies = [\"pay_ent_sub\", \"pay_ent_pass\"];\n isLoggedIn = !!bouncex.utils.cookies.read(\"CN_token_id\");\n // legacy check\n isEntitled = entitlementCookies.some((cookie) =>\n bouncex.utils.cookies.read(cookie)\n );\n // access check\n if (!isEntitled) {\n const cnAccessToken = bouncex.utils.cookies.read(\"CN_access\");\n isEntitled = determineAccessEntitlement(cnAccessToken);\n }\n return {\n isEntitled,\n isLoggedIn,\n };\n } catch (error) {\n console.error(\"Wunderkind: failed getting user status.\", error);\n return { isEntitled, isLoggedIn };\n }\n }\n // read from these values\n const { isEntitled, isLoggedIn } = getUserStatus();\n\n return isLoggedIn && isEntitled;\n \n})();\n","trigger":"pageload"},{"name":"journey_logged_in_user","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"(() => {\n // Array/list of brand product names.\n // Manually update according to the brand.\n // If a brand has no product names, default to the brand name.\n const brandProductNames = [\"newyorker\", \"tny\"];\n /**\n * Reads the CN Access token and checks if there is an active web product.\n * @param {string} cnAccessToken - CN Access Token.\n * @returns {boolean} - has the user an active web product for the brand.\n */\n function determineAccessEntitlement(cnAccessToken) {\n if (!cnAccessToken) return false;\n const decodedToken = JSON.parse(atob(cnAccessToken.split(\".\")[1]));\n const rgx = new RegExp(`(${brandProductNames.join(\"|\")})(:web|\\.com)`, \"i\");\n return Object.values(decodedToken.fct || {})\n .flat()\n .some((product) => product.match(rgx));\n }\n /**\n * Gets user entitlement and authentication status for a brand.\n * Wunderkind script to target user status in their campaigns.\n * @returns {object} - { isEntitled, isLoggedIn }\n */\n function getUserStatus() {\n let isEntitled = false;\n let isLoggedIn = false;\n try {\n const entitlementCookies = [\"pay_ent_sub\", \"pay_ent_pass\"];\n isLoggedIn = !!bouncex.utils.cookies.read(\"CN_token_id\");\n // legacy check\n isEntitled = entitlementCookies.some((cookie) =>\n bouncex.utils.cookies.read(cookie)\n );\n // access check\n if (!isEntitled) {\n const cnAccessToken = bouncex.utils.cookies.read(\"CN_access\");\n isEntitled = determineAccessEntitlement(cnAccessToken);\n }\n return {\n isEntitled,\n isLoggedIn,\n };\n } catch (error) {\n console.error(\"Wunderkind: failed getting user status.\", error);\n return { isEntitled, isLoggedIn };\n }\n }\n // read from these values\n const { isEntitled, isLoggedIn } = getUserStatus();\n\n return isLoggedIn && !isEntitled;\n \n})();\n","trigger":"pageload"},{"name":"admiral_present","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"jQuery('h1:contains(\"Get unlimited access.\")').length > 0 && jQuery('span:contains(\" by Admiral\")').length > 0;","trigger":"pageload"},{"name":"test_prioritization","polling":"all","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"}],"dgu":"pixel.cdnwidget.com","dgp":false,"ba":{"enabled":0,"fbte":0},"biu":"assets.bounceexchange.com","bau":"api.bounceexchange.com","beu":"events.bouncex.net","ibx":{"tjs":"bouncex.util = {\n\n\taddNamespace: function(obj, name) {\n\t\tvar namespacedObj = {};\n\t\tfor (var k in obj) {\n\t\t\tif (obj.hasOwnProperty(k)) {\n\t\t\t\tvar namespacedKey = k;\n\t\t\t\tif (k.indexOf(':') === -1) {\n\t\t\t\t\tnamespacedKey = name + ':' + k;\n\t\t\t\t}\n\t\t\t\tnamespacedObj[namespacedKey] = obj[k];\n\t\t\t}\n\t\t}\n\t\treturn namespacedObj;\n\t},\n\n\tgetOrigin: function() {\n\t\treturn window.location.origin || window.location.protocol + '//' + window.location.hostname + (window.location.port ? (':' + window.location.port) : '');\n\t},\n\n\t//copied from bouncex.ibx\n\tgetParam: function(name, qstring) {\n\t\tvar param_string = qstring ? ('?' + qstring) : window.location.href;\n\t\tname = name.replace(/[\\[]/,\"\\\\\\[\").replace(/[\\]]/,\"\\\\\\]\");\n\t\tvar regexS = \"[\\\\?&#]\"+name+\"=([^&#]*)\";\n\t\tvar regex = new RegExp( regexS );\n\t\tvar results = regex.exec( param_string );\n\t\tif( results == null ) return \"\";\n\t\telse return decodeURIComponent(results[1]);\n\t},\n\n\tgetTimeMs: function() {\n\t\treturn (new Date().getTime());\n\t},\n\n\tisValidInteger: function(val) {\n\t\t// returns true for 0, '0', 1, '1'. False for '', undefined\n\t\treturn !isNaN(parseInt(val));\n\t},\n\n\t//copied from bouncex.ibx\n\tisValidEmail: function(email) {\n\t\tvar regex = /^(([^<>()[\\]\\\\.,;:\\s@\\\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\\\"]+)*)|(\\\".+\\\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n\t\treturn regex.test(email);\n\t},\n\n\tisValidUrl: function(url, type) {\n\t\t//JKMD: type could differentiate between absolute/relative, allow mailto links, etc\n\t\tvar regex = /^(http|https):\\/\\/(([a-zA-Z0-9$\\-_.+!*'(),;:&=]|%[0-9a-fA-F]{2})+@)?(((25[0-5]|2[0-4][0-9]|[0-1][0-9][0-9]|[1-9][0-9]|[0-9])(\\.(25[0-5]|2[0-4][0-9]|[0-1][0-9][0-9]|[1-9][0-9]|[0-9])) {3})|localhost|([a-zA-Z0-9\\-\\u00C0-\\u017F]+\\.)+([a-zA-Z]{2,}))(:[0-9]+)?(\\/(([a-zA-Z0-9$\\-_.+!*'(),;:@&=]|%[0-9a-fA-F]{2})*(\\/([a-zA-Z0-9$\\-_.+!*'(),;:@&=]|%[0-9a-fA-F]{2})*)*)?(\\?([a-zA-Z0-9$\\-_.+!*'(),;:@&=\\/?]|%[0-9a-fA-F]{2})*)?(\\#([a-zA-Z0-9$\\-_.+!*'(),;:@&=\\/?]|%[0-9a-fA-F]{2})*)?)?$/;\n\t\treturn regex.test(url);\n\t},\n\n\tmakeQuerystring: function(o) {\n\t\tvar a=[],s='';\n\t\tfor(var k in o) {\n\t\t\tif(!o.hasOwnProperty(k)) continue;\n\t\t\ta.push(k+'='+encodeURIComponent(o[k]));\n\t\t}\n\t\treturn a.join('&');\n\t},\n\n\tmergeObject: function () {\n\t\tvar o = {};\n\t\tfor (var k in arguments) {\n\t\t\tvar a = arguments[k];\n\t\t\tif (typeof a == 'object') {\n\t\t\t\tfor (var k in a) {\n\t\t\t\t\tif (a.hasOwnProperty(k)) o[k] = a[k];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn o;\n\t}\n};\n\nbouncex.util.cookies = {\n\n\tdomain: window.bouncex.cookie_domain,\n\n\tcreate: function(obj){\n\t\tdefaults = {\n\t\t\tname : '',\n\t\t\tvalue : '',\n\t\t\tdomain : false,\n\t\t\tdays : 14\n\t\t};\n\t\tobj = bouncex.util.mergeObject(defaults, obj);\n\n\t\tif (!obj.name || !obj.value) { return false; }\n\n\t\tvar date = new Date();\n\t\tdate.setTime(date.getTime() + obj.days * 24 * 60 * 60 * 1e3);\n\t\tvar exp = '; expires=' + date.toGMTString();\n\n\t\tvar cookieString = obj.name + '=' + obj.value + exp + '; path=/;';\n\t\tif (obj.domain){\n\t\t\tcookieString += 'domain=' + obj.domain + ';';\n\t\t}\n\t\tdocument.cookie = cookieString;\n\t},\n\n\tdestroy: function (name) {\n\t\tthis.create({\n\t\t\tname : name,\n\t\t\tdays : -1,\n\t\t});\n\t},\n\n\tread: function (name) {\n\t\t//return this.multi.get(name);\n\t\tvar t = name + \"=\", vars = document.cookie.split(\";\");\n\t\tfor (var r = 0; r < vars.length; r++) {\n\t\t\tvar i = vars[r];\n\t\t\twhile (i.charAt(0) == \" \")i = i.substring(1, i.length);\n\t\t\tif (i.indexOf(t) == 0)return i.substring(t.length, i.length);\n\t\t}\n\t\treturn null;\n\t}\n};\n\n// if utk is already defined persist whatever listeners it has before wipe\nvar previousListeners = bouncex.utk && bouncex.utk.listeners;\n\nbouncex.utk = {\n\t\n\tlisteners: previousListeners || {},\n\n\taddMetadata: function(obj) {\n\t\tvar m = this.getMetadata();\n\t\treturn bouncex.util.mergeObject(obj, m);\n\t},\n\n\tgetMetadata: function() {\n\t\treturn {\n\t\t\t'page:type': this.getPageType(),\n\t\t\t'customer:hasconverted': (bouncex.cookie.lc?1:0)\n\t\t};\n\t},\n\n\tgetPageType: function() {\n\t\treturn \"\";\n\t},\n\n\thoverItem: function(obj) {\n\t\tvar defaults = {\n\t\t\teventName: 'hover item',\n\t\t\titemTracking: false,\n\t\t\tselector: '',\n\t\t\tmaxItems: 5,\n\t\t\ttimeoutMs: 1000,\n\t\t\tgetItemData: function(el) { return null; },\n\t\t};\n\n\t\tobj = bouncex.util.mergeObject(defaults, obj);\n\n\t\t//validation here\n\t\tif (!obj.selector) { return null; }\n\n\t\t//register the tracker\n\t\tobj.stop = removeHoverTracking;\n\t\tvar trackerId = bouncex.utk.register(obj);\n\t\tvar timeout;\n\t\tvar ids = [];\n\n\t\tfunction onMouseenter() {\n\t\t\tclearTimeout(timeout);\n\t\t\tvar el = this;\n\t\t\ttimeout = setTimeout(function() {\n\t\t\t\tvar item = obj.getItemData(el);\n\t\t\t\tif (!item.id) { return; }\n\t\t\t\t//if not already tracked\n\t\t\t\tif (ids.indexOf(item.id) === -1) {\n\t\t\t\t\t//add id to list of tracked items\n\t\t\t\t\tids.push(item.id);\n\t\t\t\t\t//track the event\n\t\t\t\t\tvar itemEventData = { eventName: obj.eventName, item: item };\n\t\t\t\t\tbouncex.utk.trackItemInteraction(itemEventData);\n\t\t\t\t\t//track the item\n\t\t\t\t\tif (obj.itemTracking) {\n\t\t\t\t\t\tbouncex.utk.trackItem(item);\n\t\t\t\t\t}\n\t\t\t\t\t//check limits\n\t\t\t\t\tif (ids.length >= obj.maxItems) {\n\t\t\t\t\t\tremoveHoverTracking();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}, obj.timeoutMs);\n\t\t}\n\n\t\tfunction onMouseleave() {\n\t\t\tclearTimeout(timeout);\n\t\t}\n\n\t\tfunction addHoverTracking() {\n\t\t\tjQuery(document).on('mouseenter.bx-tracking-hover.' + trackerId, obj.selector, onMouseenter);\n\t\t\tjQuery(document).on('mouseleave.bx-tracking-hover.' + trackerId, obj.selector, onMouseleave);\n\t\t}\n\n\t\tfunction removeHoverTracking() {\n\t\t\tjQuery(document).off('mouseenter.bx-tracking-hover.' + trackerId);\n\t\t\tjQuery(document).off('mouseleave.bx-tracking-hover.' + trackerId);\n\t\t\tclearTimeout(timeout);\n\t\t}\n\n\t\taddHoverTracking();\n\t\treturn trackerId;\n\t},\n\n\tisIdentified: function(){\n\t\treturn !!(bouncex.cookie.uid || bouncex.getBounceCookie('__ibxu'));\n\t},\n\n\tmiw: function(obj) {\n\t\tvar defaults = {\n\t\t\tselector: 'input:not(input[type=button], :input[type=submit], :input[type=reset], :input[type=hidden], :input[type=radio], :input[type=checkbox], :input[type=image], :input[type=password])',\n\t\t\tgetUserData: function(el) {\n\t\t\t\treturn {\n\t\t\t\t\temail : jQuery(el).val(),\n\t\t\t\t\tsource : el.id,\n\t\t\t\t};\n\t\t\t}\n\t\t};\n\n\t\tobj = bouncex.util.mergeObject(defaults, obj);\n\t\tif (!obj.selector) { return null; }\n\n\t\t//register the tracker\n\t\tobj.stop = removeUserTracking;\n\t\tvar trackerId = bouncex.utk.register(obj);\n\n\t\tfunction onBlur() {\n\t\t\tvar user = obj.getUserData(this);\n\t\t\tbouncex.utk.trackUser(user);\n\t\t}\n\n\t\tfunction removeUserTracking() {\n\t\t\tjQuery(document).off('blur.miw.' + trackerId);\n\t\t}\n\n\t\tjQuery(document).on('blur.miw.' + trackerId, obj.selector, onBlur);\n\n\t\treturn trackerId;\n\t},\n\n\tmuu: function(){\n\t\tvar match = location.href.match(/([a-zA-Z0-9._\\+-]+(?:@|%40)[a-zA-Z0-9._-]+\\.[a-zA-Z0-9._-]+)/gi);\n\t\tif (match){\n\t\t\tbouncex.utk.trackUser({\n\t\t\t\temail: decodeURIComponent(match[0]),\n\t\t\t\tsource: 'URL'\n\t\t\t});\n\t\t}\n\t},\n\n\tquickviewItem: function(obj) {\n\t\tvar defaults = {\n\t\t\teventName: 'view item',\n\t\t\titemTracking: false,\n\t\t\tselector: '',\n\t\t\tgetItemData: function(el) { return null; }\n\t\t};\n\n\t\tobj = bouncex.util.mergeObject(defaults, obj);\n\t\t//validation here\n\t\tif (!obj.selector) { return null; }\n\n\t\tvar prevVisible = false,\n\t\t\tvisible;\n\n\t\treturn bouncex.utk.setInterval({\n\t\t\tcallback: function() {\n\t\t\t\tvisible = jQuery(obj.selector).is(':visible');\n\t\t\t\tif (visible && !prevVisible) {\n\t\t\t\t\tvar item = obj.getItemData(obj.selector);\n\n\t\t\t\t\tvar itemEventData = { eventName: obj.eventName, item: item };\n\t\t\t\t\tbouncex.utk.trackItemInteraction(itemEventData);\n\t\t\t\t\t//track the item\n\t\t\t\t\tif (obj.itemTracking) {\n\t\t\t\t\t\tbouncex.utk.trackItem(item);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tprevVisible = visible;\n\t\t\t}\n\t\t});\n\t},\n\n\trequestEmail: function(obj) {\n\t\t//JKMD: bouncex.push right now automatically adds namespacing, which would mess up \"campaignid\"\n\t\tparams = {};\n\t\tfor (var k in obj) {\n\t\t\tif (obj.hasOwnProperty(k)){\n\t\t\t\tparams[k.toLowerCase()] = obj[k];\n\t\t\t}\n\t\t}\n\t\tevent_stream_report('requestemail', params);\n\t},\n\n\t//JKMD: long-term plan is to put all of our polling into a single setInterval\n\tsetInterval: function(obj) {\n\t\tvar defaults = {\n\t\t\tmilliseconds: 1000,\n\t\t\tcallback: function() { return null; }\n\t\t};\n\t\tobj = bouncex.util.mergeObject(defaults, obj);\n\t\tvar intervalId = setInterval(obj.callback, obj.milliseconds);\n\n\t\tobj.stop = removeInterval;\n\t\tvar trackerId = bouncex.utk.register(obj);\n\t\tfunction removeInterval() {\n\t\t\tclearInterval(intervalId);\n\t\t}\n\t\treturn trackerId;\n\t},\n\n\ttrackItem: function(item) {\n\t\tif (typeof(item.id) === 'string'){\n\t\t\titem.id = item.id.trim().toLowerCase();\n\t\t}\n\t\tif (!this.validateItem(item)) {\n\t\t\t//bouncex.log('item failed validation', item);\n\t\t\treturn false;\n\t\t}\n\t\titem = bouncex.util.addNamespace(item, 'item');\n\t\tbouncex.push(['item', item]);\n\t},\n\n\ttrackItemInteraction: function(obj) {\n\t\tvar id = obj.item.id;\n\t\tif (typeof(id) === 'string'){\n\t\t\tid = id.trim().toLowerCase();\n\t\t}\n\t\tvar o = { 'item:id': id };\n\t\to = this.addMetadata(o);\n\t\tbouncex.push([obj.eventName, o]);\n\t},\n\n\ttrackListPage: function(obj){\n\t\tvar defaults = {\n\t\t\teventName: 'view ' + this.getPageType(),\n\t\t\tmaxItems: 6,\n\t\t\tselector: '',\n\t\t\ttitle: '',\n\t\t\turl: jQuery('link[rel=canonical]').attr('href') || window.location.href.split('?')[0],\n\t\t\titemTracking : false,\n\t\t\tgetItemData: function(el) { return null;},\n\t\t\textraEventData: {}\n\t\t};\n\n\t\tobj = bouncex.util.mergeObject(defaults, obj);\n\n\t\tvar items = jQuery(obj.selector);\n\t\tif (!items || !items.length){\n\t\t\treturn false;\n\t\t}\n\t\tvar itemsTracked = 0;\n\t\tvar itemIds = [];\n\t\tfor (var i = 0; i < items.length && itemsTracked < obj.maxItems; i++) {\n\t\t\tvar item = obj.getItemData(items[i]);\n\t\t\tif (item.id){\n\t\t\t\tif (typeof(item.id) === 'string'){\n\t\t\t\t\titem.id = item.id.trim().toLowerCase();\n\t\t\t\t}\n\t\t\t\t// add id to list\n\t\t\t\titemIds.push(item.id);\n\t\t\t\tif (obj.itemTracking){\n\t\t\t\t\t//track full item\n\t\t\t\t\tthis.trackItem(item);\n\t\t\t\t}\n\t\t\t\titemsTracked++;\n\t\t\t}\n\t\t}\n\n\t\tvar o = {'items:ids' : itemIds.join(','), 'page:url' : obj.url};\n\t\tif (obj.title){\n\t\t\to['page:title'] = obj.title;\n\t\t}\n\t\to = this.addMetadata(o);\n\t\to = bouncex.util.mergeObject(o, obj.extraEventData);\n\t\tbouncex.push([obj.eventName, o]);\n\t},\n\n\ttrackUser: function(user) {\n\t\tif (!user.email && !user.emailHash) {\n\t\t\treturn false;\n\t\t}\n\t\tif (user.email && !bouncex.util.isValidEmail(user.email)){\n\t\t\treturn false;\n\t\t}\n\t\tvar params = bouncex.util.addNamespace(user, 'user');\n\t\tif (user.email) {\n\t\t\tparams['user:email'] = user.email;\n\t\t}\n\t\tif (user.emailHash) {\n\t\t\tparams['user:emailhash'] = user.emailHash;\n\t\t}\n\t\tif (user.campaignId) {\n\t\t\tparams['campaignid'] = user.campaignId;\n\t\t}\n\t\tparams['user:gcr'] = (bouncex && bouncex.cookie) ? bouncex.cookie.gcr : 99;\n\t\tparams['agent'] = 'js';\n\t\tparams['eq'] = 1;\n\n\t\tevent_stream_report('user', params);\n\n\t\tbouncex.cookie.uid = 1;\n\t\tsetBounceCookie();\n\t\t//legacy support\n\t\tbouncex.util.cookies.create({\n\t\t\tname: '__ibxu',\n\t\t\tvalue : '1',\n\t\t\tdomain : '.' + bouncex.util.cookies.domain,\n\t\t\tdays : 365,\n\t\t});\n\n\t},\n\n\tvalidateItem: function(item) {\n\t\tif (!item) { return false; }\n\t\tif (!item.id) { return false; }\n\t\tif (!item.copy) { return false; }\n\t\tif (!item.imageurl || !bouncex.util.isValidUrl(item.imageurl)) { return false; }\n\t\tif (!item.url || !bouncex.util.isValidUrl(item.url)) { return false; }\n\t\treturn true;\n\t},\n\n\tviewItem: function(obj) {\n\t\tvar defaults = {\n\t\t\teventName: 'view item',\n\t\t\titemTracking: true,\n\t\t\tgetItemData: function() { return null; }\n\t\t};\n\n\t\tobj = bouncex.util.mergeObject(defaults, obj);\n\n\t\tvar item = obj.getItemData();\n\n\t\tif (obj.itemTracking) {\n\t\t\tthis.trackItem(item);\n\t\t}\n\n\t\tif (item.id) {\n\t\t\tvar itemEventData = { eventName: obj.eventName, item: item };\n\t\t\tbouncex.utk.trackItemInteraction(itemEventData);\n\t\t} else {\n\t\t\t//bouncex.log('no item id', obj.eventName, item);\n\t\t}\n\t},\n\n\t//keeping track of the listeners inside tracking\n\tregister: function(obj) {\n\t\tvar id = bouncex.util.getTimeMs() + Math.random();\n\t\tbouncex.utk.listeners[id] = obj;\n\t\treturn id;\n\t},\n\n\t//remove single tracker\n\tstop: function(id) {\n\t\tif (bouncex.utk.listeners.hasOwnProperty(id)) {\n\t\t\tbouncex.utk.listeners[id].stop();\n\t\t\tdelete bouncex.utk.listeners[id];\n\t\t}\n\t},\n\n\t//remove all listeners\n\tstopAll: function() {\n\t\tfor (var id in bouncex.utk.listeners) {\n\t\t\tbouncex.utk.stop(id);\n\t\t}\n\t}\n};\n\nbouncex.utk.cart = {\n\n\tgetCart: function() {\n\t\tif (this.state) {\n\t\t//cached here once we look it up or save\n\t\t\treturn this.state;\n\t\t}else if (this.config.storeCartVariable && bouncex.vars[this.config.storeCartVariable]) {\n\t\t//look up from cvar if it exists\n\t\t\tthis.state = JSON.parse(bouncex.vars[this.config.storeCartVariable]);\n\t\t\treturn this.state;\n\t\t}else {\n\t\t\treturn {};\n\t\t}\n\t},\n\n\tgetCount: function(){\n\t\treturn bouncex.vars[this.config.cartCountVariable];\n\t},\n\n\tinferCount: function(cart) {\n\t\t// return cart.count if specified and valid\n\t\tif (bouncex.util.isValidInteger(cart.count)) {\n\t\t\treturn parseInt(cart.count);\n\t\t} else if (cart.items) {\n\t\t\t// deduce from items length (using qty property if specified)\n\t\t\tvar count = 0;\n\t\t\tfor (var i = 0; i < cart.items.length; i++) {\n\t\t\t\tvar qty = parseInt(cart.items[i].qty) || 1;\n\t\t\t\tcount += qty;\n\t\t\t}\n\t\t\treturn count;\n\t\t}else if (bouncex.util.isValidInteger(this.getCount())){\n\t\t\treturn parseInt(this.getCount());\n\t\t}else{\n\t\t\treturn 0;\n\t\t}\n\t},\n\n\tinit: function(obj) {\n\t\tvar defaults = {\n\t\t\t// lastReplenishment: false,\n\t\t\tstoreCartVariable: 'cart',\n\t\t\tcartCountVariable: 'cart_qty',\n\t\t\tmaxVariableSize: 400,\n\t\t\tstoreValues: ['count', 'items'],\n\t\t\tmaxItems: 10\n\t\t};\n\t\tobj = bouncex.util.mergeObject(defaults, obj);\n\t\tthis.config = obj;\n\n\t\t//JKMD: should we do this via init, or just override explicitly...?\n\t\tthis.replenish = obj.replenish || this.replenish;\n\t\tthis.validateReplenishment = obj.validateReplenishment || this.validateReplenishment;\n\t\tthis.reportReplenishment = obj.reportReplenishment || this.reportReplenishment;\n\n\t\tthis.initFromQuerystring();\n\t\tthis.reportReplenishment();\n\t},\n\n\tinitFromQuerystring: function() {\n\t\tvar bx_cart = bouncex.util.getParam('bx_cart');\n\t\tvar cart = {};\n\t\tthis.replenishing = false;\n\n\t\tif (bx_cart) {\n\t\t\t//JKMD: support base64\n\t\t\tif (bx_cart.charAt(0) !== '{') {\n\t\t\t\tbx_cart = atob(bx_cart);\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tcart = JSON.parse(bx_cart);\n\t\t\t} catch(e) { console.log(e); return false; }\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (!this.validateReplenishment(cart)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tthis.save(cart);\n\t\tthis.replenishing = true;\n\t\treturn this.replenish(cart);\n\t},\n\n\treplenish: function(cart) {\n\t\treturn null;\n\t},\n\n\tsave: function(cart) {\n\t\tif (!cart) { return false; }\n\t\tthis.state = cart;\n\t\tif (this.config.storeCartVariable) {\n\t\t\tvar storedCart = {};\n\t\t\tif (cart.count === 0) {\n\t\t\t\t// if count is 0, don't store any other info\n\t\t\t\tstoredCart = { count: 0 };\n\t\t\t}else{\n\t\t\t\t//store values specified in settings\n\t\t\t\tfor (var i = 0; i < this.config.storeValues.length; i++) {\n\t\t\t\t\tvar k = this.config.storeValues[i];\n\t\t\t\t\tif (cart.hasOwnProperty(k)) {\n\t\t\t\t\t\tstoredCart[k] = cart[k];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.checkAndSetVar(storedCart);\n\t\t}\n\t},\n\n\tcheckAndSetVar: function(storedCart) {\n\t\tvar cartString = JSON.stringify(storedCart);\n\t\tif (cartString.length <= this.config.maxVariableSize) {\n\t\t\tbouncex.setv(this.config.storeCartVariable, cartString);\n\t\t\tsetBounceCookie();\n\t\t} else if (storedCart.items && storedCart.items.length) {\n\t\t\tvar lastItemLength = JSON.stringify(storedCart.items[storedCart.items.length-1]).length;\n\t\t\tif ( lastItemLength >= this.config.maxVariableSize) {\n\t\t\t\tstoredCart.items.pop();\n\t\t\t} else {\n\t\t\t\tstoredCart.items.shift();\n\t\t\t}\n\t\t\tthis.checkAndSetVar(storedCart);\n\t\t}\n\t},\n\n\ttrack: function(cart) {\n\t\tvar trackCart = bouncex.util.mergeObject(cart);\n\t\tif (trackCart.items) trackCart.items = JSON.stringify(trackCart.items);\n \t\tif (trackCart.ids) trackCart.ids = trackCart.ids.join(',');\n\t\ttrackCart = bouncex.util.addNamespace(trackCart, 'cart');\n\t\tbouncex.push(['cart', trackCart]);\n\t},\n\n\tupdate: function (obj) {\n\t\tvar cart = {};\n\n\t\tif (this.replenishing){\n\t\t\t/* don't fire cart events while replenishing */\n\t\t\treturn false;\n\t\t}\n\n\t\tif (obj.newItem) {\n\t\t\t//if partial, merge new item with stored items\n\t\t\tvar oldCart = this.getCart();\n\t\t\tvar allItems = oldCart.items || [];\n\t\t\tallItems.push(obj.newItem);\n\t\t\tobj.items = allItems;\n\t\t}\n\n\t\t// pass relevant properties to cart\n\t\tcart.count = obj.count;\n\t\tif (obj.items && obj.items.length) { cart.items = obj.items; }\n\t\tif (obj.ids && obj.ids.length) { cart.ids = obj.ids; }\n\t\tif (obj.token) { cart.token = obj.token; }\n\t\tif (obj.value) { cart.value = obj.value; }\n\n\n\t\t//set count\n\t\tcart.count = this.inferCount(cart);\n\n\t\t// remove items from beginning of items array if over limit\n\t\tif (this.config.maxItems && cart.items && cart.items.length > this.config.maxItems) {\n\t\t\tcart.items = cart.items.slice(cart.items.length - this.config.maxItems);\n\t\t}\n\n\t\t//auto parse ids from items variable if no ids specified\n\t\tif (!cart.ids && cart.items) {\n\t\t\tvar ids = [];\n\t\t\tfor (var i = 0; i < cart.items.length; i++) {\n\t\t\t\tif (cart.items[i].id) {\n\t\t\t\t\tids.push(cart.items[i].id);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (ids.length) { cart.ids = ids; }\n\t\t}\n\n\t\t// save in cart.state, and in cvar if specified\n\t\tthis.save(cart);\n\t\t//track cart\n\t\tthis.track(cart);\n\t\t//fire add to cart event if new item or addToCart flag\n\t\tif (obj.newItem || obj.addToCart){\n\t\t\tbouncex.push(['add to cart', bouncex.utk.getMetadata()]);\n\t\t}\n\t},\n\n\tvalidateReplenishment: function(cart) {\n\t\tvar cartCount = bouncex.utk.cart.getCount();\n\t\tif (bouncex.util.isValidInteger(cartCount) && cartCount > 0) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (!cart) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (!cart.value && !cart.token && !cart.items) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t},\n\n\treportReplenishment: function() {\n\t\tvar bx_replen = bouncex.util.getParam('bx_replen');\n\t\tif (bx_replen) {\n\t\t\tsetTimeout(function(){\n\t\t\t\tvar cartCount = bouncex.utk.cart.getCount();\n\t\t\t\tbouncex.push(['cart replenish', {'cart:count': cartCount, 'cart:success': cartCount > 0}]);\n\t\t\t}, 1100);\n\t\t}\n\t}\n};\n\nfunction onSubscriptionPage(){\n\tif (window.location.href.indexOf('subscribe.newyorker.com/subscribe/newyorker') > -1){\n\t\treturn true;\n\t}\n\tif (window.location.href.indexOf('subscribe/splits/newyorker') > -1){\n\t\treturn true;\n\t}\n}\n\nbouncex.utk.getPageType = function() {\n\tif (onSubscriptionPage()) {\n\t\treturn 'subscription';\n\t}\n\tif (window.location.href.indexOf('account.newyorker.com/myaccount/profile') > -1) {\n\t\treturn 'account';\n\t}\n\n\treturn '';\n\n};\n\nbouncex.utk.miw = function(obj) {\n\tvar defaults = {\n\t\tselector: 'input:not(input[type=button], :input[type=submit], :input[type=reset], :input[type=hidden], :input[type=radio], :input[type=checkbox], :input[type=image], :input[type=password])',\n\t\tgetUserData: function(el) {\n\t\t\treturn {\n\t\t\t\temail : jQuery(el).val(),\n\t\t\t\tsource : el.id,\n\t\t\t};\n\t\t}\n\t};\n\n\tobj = bouncex.util.mergeObject(defaults, obj);\n\n\t//validation here\n\tif (!obj.selector) { return null; }\n\n\tfunction onBlur() {\n\t\tvar user = obj.getUserData(this);\n\t\tbouncex.utk.trackUser(user);\n\t}\n\n\tvar removeUserTracking;\n\tif (typeof jQuery.fn.on === 'function') {\n\t\tremoveUserTracking = function() {\n\t\t\tjQuery(document).off('blur.miw.' + trackerId);\n\t\t};\n\n\t\tjQuery(document).on('blur.miw.' + trackerId, obj.selector, onBlur);\n\t} else if (typeof jQuery.fn.delegate === 'function') {\n\t\tremoveUserTracking = function() {\n\t\t\tjQuery(document).undelegate(obj.selector, 'blur.miw.' + trackerId);\n\t\t};\n\n\t\tjQuery(document).delegate(obj.selector, 'blur.miw.' + trackerId, onBlur);\n\t}\n\n\t//register the tracker\n\tobj.stop = removeUserTracking;\n\tvar trackerId = bouncex.utk.register(obj);\n\n\treturn trackerId;\n};\n\nvar getCustomerMetadata = function() {\n\treturn bouncex.vars.logged_in ? 1 : 0;\n};\n\nvar getSubscriptionMapping = function() {\n\treturn {\n\t\t'Print & Digital' : 'bundle_offer',\n\t\t'Print' : 'print_offer',\n\t\t'Digital' : 'digital_offer'\n\t};\n};\n\n\nvar trackSubChoiceCart = function(pageType) {\n\tvar subNumber = getSubNumber();\n\n\tbouncex.utk.cart.update({\n\t\tcount: 1,\n\t\titems: [{sub_number: subNumber}],\n\t\taddToCart: true\n\t});\n};\n\nvar getSubscriptionButtons = function(){\n\t/* desktop */\n\tvar buttonType3 = jQuery('#offer_container').find('.panel');\n\tif (buttonType3.length){\n\t\treturn buttonType3;\n\t}\n\t/* typically mobile */\n\tvar buttonType1 = jQuery('div[id*=offer]');\n\tif (buttonType1.length){\n\t\treturn buttonType1;\n\t}\n\t/* alternate mobile selector, and some desktop */\n\tvar buttonType2 = jQuery('#formatSelection .format');\n\tif (buttonType2.length){\n\t\treturn buttonType2;\n\t}\n};\n\nvar bindSubChoiceListeners = function(pageType) {\n\n\tvar $subscriptionOffers = getSubscriptionButtons();\n\n\tvar subChoiceSelect = {\n\t\tstop : function(){\n\t\t\t$subscriptionOffers.off('click.bx' + subChoiceSelect.id);\n\t\t}\n\t};\n\n\tsubChoiceSelect.id = bouncex.utk.register(subChoiceSelect);\n\n\tif ($subscriptionOffers.length > 0) {\n\t\t$subscriptionOffers.on('click.bx' + subChoiceSelect.id, function(event) {\n\t\t\tvar metadata = bouncex.utk.addMetadata({\n\t\t\t\t'customer:isreturning' : getCustomerMetadata(),\n\t\t\t\t'subscription:number' : getSubNumber()\n\t\t\t});\n\t\t\tbouncex.push(['subscription choice', metadata]);\n\t\t\tsetTimeout(function() {\n\t\t\t\ttrackSubChoiceCart(pageType);\n\t\t\t}, 500);\n\t\t});\n\t}\n};\n\nvar handleAjax = function() {\n\t// for detecting native email submits and signing in\n\tvar tnyAjax = {\n\t\tstop : function(){\n\t\t\tjQuery(document).off('ajaxComplete.bx-' + tnyAjax.id);\n\t\t},\n\t};\n\n\ttnyAjax.id = bouncex.utk.register(tnyAjax);\n\n\tjQuery(document).on('ajaxComplete.bx-' + tnyAjax.id, function(event,xhr,settings) {\n\t\ttry{\n\t\t\tif (settings.type === 'POST' && xhr.status === 200) {\n\t\t\t\tif (settings.url.indexOf('/admin-ajax') > -1 && settings.data.indexOf('submit-newsletter') > -1) {\n\t\t\t\t\tbouncex.push(['email signup', bouncex.utk.addMetadata({'email:source' : 'native', 'customer:isreturning': getCustomerMetadata()})]);\n\t\t\t\t}\n\t\t\t}\n\t\t} catch(e){\n\t\t\tconsole.log(e);\n\t\t}\n\t});\n};\n\nvar reportLogin = function(){\n\tif (!bouncex.vars.login_reported && bouncex.vars.logged_in) { \n\t\tbouncex.push(['log in', bouncex.utk.getMetadata()]);\n\t\tbouncex.setv('login_reported', true);\n\t\tbouncex.setBounceCookie(); \n\t}\n};\n\nvar checkLoginStatus = function() {\n\tvar $signInLink = jQuery('#sign-in-list'),\n\t\t$emailField = jQuery('.profile-entry:contains(\"E-mail address\") .field-breakln').next('div');\n\n\tif ($emailField.length) {\n\t\temailValue = $emailField.text().trim();\n\t\tbouncex.utk.trackUser({\n\t\t\temail : emailValue,\n\t\t\tsource : 'account page',\n\t\t});\n\t}\n};\n\n\nvar getSubNumber = function(){\n\tvar match = location.href.match(/subscribe\\/newyorker\\/(\\d+)/);\n\tif (match){\n\t\treturn match[1];\n\t}\n\t/* adding support for alternate url structure i.e. condenastdigital.com/subscribe/splits/newyorker/NYR_Site_1yearoffer_6buttons_desktop -SK */\n\tvar match2 = location.href.match(/subscribe\\/splits\\/newyorker\\/(\\w+)/);\n\tif (match2){\n\t\treturn match2[1].toLowerCase();\n\t}\n};\n\nbouncex.utk.init = function() {\n\t//manually set inputs to listen on\n\tbouncex.utk.miw({\n\t\tselector: 'input:not(input[type=button], :input[type=submit], :input[type=reset], :input[type=hidden], :input[type=radio], :input[type=checkbox], :input[type=image], :input[type=password], .offerGiftRecip input)',\n\t});\n\t//Cancel any existing listeners. Crucial for Angular sites\n\tbouncex.utk.stopAll();\n\n\tvar pageType = bouncex.utk.getPageType();\n\n\t\tbouncex.utk.cart.init();\n\n\tif (pageType.indexOf('subscription') > -1){\n\t\tif (window.location.href.indexOf('bx_choice_replenish') === -1) {\n\t\t\tvar metadata = bouncex.utk.addMetadata({\n\t\t\t\t'customer:isreturning' : getCustomerMetadata(),\n\t\t\t\t'subscription:number' : getSubNumber()\n\t\t\t});\n\t\t\tbouncex.push(['subscription abandonment', metadata]);\n\t\t\tbindSubChoiceListeners(pageType);\n\t\t}\n\t}\n\n\tif (pageType == 'account') {\n\t\tcheckLoginStatus();\n\t}\n\n\treportLogin();\n\thandleAjax();\n\n};\n\nbouncex.utk.init();","cjs":"","miw":0,"mibcx":1,"te":1,"cart_rep":{"get":"","set":"var ibxFormData = decodeURIComponent(bouncex.ibx._getparam('ibx_cart'));\nif (ibxFormData) {\n\tlocalStorage.setItem('ibxFormData', ibxFormData);\n}\nif (bouncex.state.mobile) {\n window.location.href = '/subscribe/newyorker/102345';\n}"},"ulpj":{"spUserID":"espemailid"},"cus":"","miw_exclude":"","enabled":1},"etjson":null,"osre":true,"osru":"osr.bounceexchange.com/v1/osr/items","checkDfp":true,"gamNetwork":"3379","spa":1,"spatm":0,"preinit_cjs":"","crs":{"integrations":null,"pageCount":null},"mat":0,"math":0,"cpnu":"coupons.bounceexchange.com","dfpcms":0,"sms":{"optm":"","eventSharing":false,"shqId":"","enabled":0},"pde":false,"fme":false,"fmx":"","sdk":{"android":{"enabled":false,"enabledVersions":[],"eventModifications":null},"ios":{"enabled":false,"enabledVersions":[],"eventModifications":null}},"onsite":{"enabled":1},"ads":{"enabled":0},"pubs":{"enabled":1},"websdk":{"enabled":0},"ga4_property_id":"","ga4_measurement_id":""} ; bouncex.tag = 'tag3'; bouncex.$ = window.jQuery; bouncex.env = 'production'; bouncex.restrictedTlds = {"casl":{"ca":1},"gdpr":{"ad":1,"al":1,"at":1,"ax":1,"ba":1,"be":1,"bg":1,"by":1,"xn--90ais":1,"ch":1,"cy":1,"cz":1,"de":1,"dk":1,"ee":1,"es":1,"eu":1,"fi":1,"fo":1,"fr":1,"uk":1,"gb":1,"gg":1,"gi":1,"gr":1,"hr":1,"hu":1,"ie":1,"im":1,"is":1,"it":1,"je":1,"li":1,"lt":1,"lu":1,"lv":1,"mc":1,"md":1,"me":1,"mk":1,"xn--d1al":1,"mt":1,"nl":1,"no":1,"pl":1,"pt":1,"ro":1,"rs":1,"xn--90a3ac":1,"ru":1,"su":1,"xn--p1ai":1,"se":1,"si":1,"sj":1,"sk":1,"sm":1,"ua":1,"xn--j1amh":1,"va":1,"tr":1}}; bouncex.client = { supportsBrotli: 1 }; bouncex.assets = {"ads":"e2e1dbb7c70b701b3c197204872400a0","creativesBaseStyles":"a53944a2","gam_3379":"//assets.bounceexchange.com/assets/gam/3379/5e0ad74bff4e13181664b4f1b4d6cf4a.json","gpsAuction":"1375a7b38c31e98d14fe7f396b72da14","inbox":"02aca5df0e176b8810a86da97ac05424","onsite":"0e56ab6ba004ee080ce3deb3edae35e9","sms":"e39203556bab2366e56296ce42e974a7","websdk":"0704dae1eb637cbeb4a847506058402d"}; bouncex.push = function(pushData) { bouncex.pushedData.push(pushData); } var runtime = document.createElement('script'); runtime.setAttribute('src', '//assets.bounceexchange.com/assets/smart-tag/versioned/runtime_6459738026535cda4232dc813c61447d.br.js'); runtime.setAttribute('async', 'async'); runtime.setAttribute('onload', 'bouncex.initializeTag()'); bouncex.initializeTag = function() { var script = document.createElement('script'); script.setAttribute('src', '//assets.bounceexchange.com/assets/smart-tag/versioned/main-v2_1247731b761376f768004922730ab4f3.br.js'); script.setAttribute('async', 'async'); document.body.appendChild(script); bouncex.initializeTag = function() {}; }; document.body.appendChild(runtime); } } if (document.readyState === "loading") { document.addEventListener("DOMContentLoaded", bxBootstrap); } else { bxBootstrap(); }})();