<commit_before>- defaultOptions = {grecaptcha: true, stripev3: false, sailthru: true, marketo: true, quantcast: false}
- options = options ? Object.assign({}, defaultOptions, options) : defaultOptions

//- Common bundle
script( src=asset("/assets/runtime-manifest.js") )
script( src=asset("/assets/common.js") )

if options.marketo
  //- Marketo Tracking
  script(type='text/javascript', src='https://d1s2w0upia4e9w.cloudfront.net/assets/conversionpath-0.3.8.min.js').
    {
    "nolog": true,
    "stageMappings": {
      "initial": [
        {
          "when": "{referrer.domain}",
          "matches": "{internal.domain}",
          "skip": "RC_First_Channel__c"
        },
        {
          "when": "{referrer.domain}",
          "matches": "{internal.domain}",
          "skip": "RC_First_Medium__c"
        },
        {
          "when": "{referrer.domain}",
          "matches": "{internal.domain}",
          "skip": "RC_First_Source_Detail__c"
        }
      ],
      "rolling": [
        {
          "when": "{referrer.domain}",
          "matches": "{internal.domain}",
          "skip": "RC_Acquisition_Channel__c"
        },
        {
          "when": "{referrer.domain}",
          "matches": "{internal.domain}",
          "skip": "RC_Acquisition_Medium__c"
        },
        {
          "when": "{referrer.domain}",
          "matches": "{internal.domain}",
          "skip": "RC_Acquisition_Source_Detail__c"
        }
      ],
      "recent": [
        {
          "when": "{referrer.domain}",
          "matches": "{internal.domain}",
          "skip": "RC_Recent_Channel__c"
        },
        {
          "when": "{referrer.domain}",
          "matches": "{internal.domain}",
          "skip": "RC_Recent_Medium__c"
        },
        {
          "when": "{referrer.domain}",
          "matches": "{internal.domain}",
          "skip": "RC_Recent_Source_Detail__c"
        }
      ]
    },
    "nameMappings": {
      "RC_First_Medium__c": "utm_medium_First_Touch__c",
      "RC_First_Source__c": "utm_source_First_Touch__c",
      "RC_First_Campaign__c": "utm_campaign_First_Touch__c",
      "RC_First_Term__c": "utm_term_First_Touch__c",
      "RC_First_Content__c": "utm_content_First_Touch__c",
      "RC_First_Source_Detail__c": "Web_Referrer_First_Touch__c",
      "RC_Acquisition_Medium__c": "utm_medium_Lead_Creation__c",
      "RC_Acquisition_Source__c": "utm_source_Lead_Creation__c",
      "RC_Acquisition_Campaign__c": "utm_campaign_Lead_Creation__c",
      "RC_Acquisition_Term__c": "utm_term_Lead_Creation__c",
      "RC_Acquisition_Content__c": "utm_content_Lead_Creation__c",
      "RC_Acquisition_Source_Detail__c": "Web_Referrer_Lead_Creation__c",
      "RC_Recent_Medium__c": "utm_medium_Most_Recent__c",
      "RC_Recent_Source__c": "utm_source_Most_Recent__c",
      "RC_Recent_Campaign__c": "utm_campaign_Most_Recent__c",
      "RC_Recent_Term__c": "utm_term_Most_Recent__c",
      "RC_Recent_Content__c": "utm_content_Most_Recent__c",
      "RC_Recent_Source_Detail__c": "Web_Referrer_Most_Recent__c"
    },
    "cookies": {
      "useCompatibleNames": false
    },
    "session": {
      "duration": {
        "recent": 30
      },
      "internalDomains": {
        "alternates": [
          "artsy.space",
          "artsy.info"
        ]
      },
      "prioritizeNonDirect": {
        "recent": true
      }
    }
    }

//- Disable Parsely on non-article pages before loading Segment
script( type="text/javascript" ).
  if (!location.pathname.match(new RegExp("#{sd.EDITORIAL_PATHS}"))){
    window.PARSELY = {autotrack: false}
  }

//- Segment.io
script( type="text/javascript" ).
  !function(){var analytics=window.analytics=window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","group","track","ready","alias","page","once","off","on"];analytics.factory=function(t){return function(){var e=Array.prototype.slice.call(arguments);e.unshift(t);analytics.push(e);return analytics}};for(var t=0;t<analytics.methods.length;t++){var e=analytics.methods[t];analytics[e]=analytics.factory(e)}analytics.load=function(t){var e=document.createElement("script");e.type="text/javascript";e.async=!0;e.src=("https:"===document.location.protocol?"https://":"http://")+"cdn.segment.com/analytics.js/v1/"+t+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(e,n)};analytics.SNIPPET_VERSION="3.0.1";
  analytics.load("#{sd.SEGMENT_WRITE_KEY}");
  }}();

//- Wire up sharify
if sharify
  != sharify.script()

//- Stripe
if options.stripev3
  script(id="stripe-js", src="https://js.stripe.com/v3/")

//- Analytics & common asset package
if sd.BROWSER && sd.BROWSER.family != 'Other'
  script( src=asset('/assets/analytics.js') )

//- Quantcast
if options.quantcast
  script( type="text/javascript" ).
    var ezt = ezt ||[];
    (function(){
      var elem = document.createElement('script');
      elem.src = (document.location.protocol == "https:" ? "https://secure" : "http://pixel") + ".quantserve.com/aquant.js?a=p-cMwS3F29bthyC";
      elem.async = true;
      elem.type = "text/javascript";
      var scpt = document.getElementsByTagName('script')[0];
      scpt.parentNode.insertBefore(elem,scpt);
    }());
    ezt.push({qacct: 'p-cMwS3F29bthyC', orderid: '', revenue: ''});

  noscript
    img( src="//pixel.quantserve.com/pixel/p-cMwS3F29bthyC.gif?labels=_fp.event.Default" style="display: none;" border="0" height="1" width="1" alt="Quantcast" )

//- Sailthru Horizon JS - user interest data, personalization
if options.sailthru
  if sd.INCLUDE_SAILTHRU
    script( type="text/javascript" ).
      (function() {
        function loadHorizon() {
          var s = document.createElement('script');
          s.type = 'text/javascript';
          s.async = true;
          s.src = location.protocol + '//ak.sail-horizon.com/horizon/v1.js';
          var x = document.getElementsByTagName('script')[0];
          x.parentNode.insertBefore(s, x);
        }
        loadHorizon();
        function loadSailthru() {
          if(typeof Sailthru !== "undefined"){
            Sailthru.setup({
              domain: 'horizon.artsy.net',
              useStoredTags: false
            });
          }
          else{
              setTimeout(loadSailthru, 250);
          }
        }
        var oldOnLoad = window.onload;
        window.onload = function() {
          if (typeof oldOnLoad === 'function') {
            oldOnLoad();
          }
          loadSailthru();
        };
      })();

//- Prefetch links on hover. See: https://instant.page/
if sd.ENABLE_INSTANT_PAGE
  include instant-page

//- Google reCAPTCHA
if options.grecaptcha && sd.RECAPTCHA_KEY && !sd.EIGEN
  script(id="google-recaptcha" src="https://www.google.com/recaptcha/api.js?render=#{sd.RECAPTCHA_KEY}")<commit_msg>Defer loading of the recaptcha script<commit_after>- defaultOptions = {grecaptcha: true, stripev3: false, sailthru: true, marketo: true, quantcast: false}
- options = options ? Object.assign({}, defaultOptions, options) : defaultOptions

//- Common bundle
script( src=asset("/assets/runtime-manifest.js") )
script( src=asset("/assets/common.js") )

if options.marketo
  //- Marketo Tracking
  script(type='text/javascript', src='https://d1s2w0upia4e9w.cloudfront.net/assets/conversionpath-0.3.8.min.js').
    {
    "nolog": true,
    "stageMappings": {
      "initial": [
        {
          "when": "{referrer.domain}",
          "matches": "{internal.domain}",
          "skip": "RC_First_Channel__c"
        },
        {
          "when": "{referrer.domain}",
          "matches": "{internal.domain}",
          "skip": "RC_First_Medium__c"
        },
        {
          "when": "{referrer.domain}",
          "matches": "{internal.domain}",
          "skip": "RC_First_Source_Detail__c"
        }
      ],
      "rolling": [
        {
          "when": "{referrer.domain}",
          "matches": "{internal.domain}",
          "skip": "RC_Acquisition_Channel__c"
        },
        {
          "when": "{referrer.domain}",
          "matches": "{internal.domain}",
          "skip": "RC_Acquisition_Medium__c"
        },
        {
          "when": "{referrer.domain}",
          "matches": "{internal.domain}",
          "skip": "RC_Acquisition_Source_Detail__c"
        }
      ],
      "recent": [
        {
          "when": "{referrer.domain}",
          "matches": "{internal.domain}",
          "skip": "RC_Recent_Channel__c"
        },
        {
          "when": "{referrer.domain}",
          "matches": "{internal.domain}",
          "skip": "RC_Recent_Medium__c"
        },
        {
          "when": "{referrer.domain}",
          "matches": "{internal.domain}",
          "skip": "RC_Recent_Source_Detail__c"
        }
      ]
    },
    "nameMappings": {
      "RC_First_Medium__c": "utm_medium_First_Touch__c",
      "RC_First_Source__c": "utm_source_First_Touch__c",
      "RC_First_Campaign__c": "utm_campaign_First_Touch__c",
      "RC_First_Term__c": "utm_term_First_Touch__c",
      "RC_First_Content__c": "utm_content_First_Touch__c",
      "RC_First_Source_Detail__c": "Web_Referrer_First_Touch__c",
      "RC_Acquisition_Medium__c": "utm_medium_Lead_Creation__c",
      "RC_Acquisition_Source__c": "utm_source_Lead_Creation__c",
      "RC_Acquisition_Campaign__c": "utm_campaign_Lead_Creation__c",
      "RC_Acquisition_Term__c": "utm_term_Lead_Creation__c",
      "RC_Acquisition_Content__c": "utm_content_Lead_Creation__c",
      "RC_Acquisition_Source_Detail__c": "Web_Referrer_Lead_Creation__c",
      "RC_Recent_Medium__c": "utm_medium_Most_Recent__c",
      "RC_Recent_Source__c": "utm_source_Most_Recent__c",
      "RC_Recent_Campaign__c": "utm_campaign_Most_Recent__c",
      "RC_Recent_Term__c": "utm_term_Most_Recent__c",
      "RC_Recent_Content__c": "utm_content_Most_Recent__c",
      "RC_Recent_Source_Detail__c": "Web_Referrer_Most_Recent__c"
    },
    "cookies": {
      "useCompatibleNames": false
    },
    "session": {
      "duration": {
        "recent": 30
      },
      "internalDomains": {
        "alternates": [
          "artsy.space",
          "artsy.info"
        ]
      },
      "prioritizeNonDirect": {
        "recent": true
      }
    }
    }

//- Disable Parsely on non-article pages before loading Segment
script( type="text/javascript" ).
  if (!location.pathname.match(new RegExp("#{sd.EDITORIAL_PATHS}"))){
    window.PARSELY = {autotrack: false}
  }

//- Segment.io
script( type="text/javascript" ).
  !function(){var analytics=window.analytics=window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","group","track","ready","alias","page","once","off","on"];analytics.factory=function(t){return function(){var e=Array.prototype.slice.call(arguments);e.unshift(t);analytics.push(e);return analytics}};for(var t=0;t<analytics.methods.length;t++){var e=analytics.methods[t];analytics[e]=analytics.factory(e)}analytics.load=function(t){var e=document.createElement("script");e.type="text/javascript";e.async=!0;e.src=("https:"===document.location.protocol?"https://":"http://")+"cdn.segment.com/analytics.js/v1/"+t+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(e,n)};analytics.SNIPPET_VERSION="3.0.1";
  analytics.load("#{sd.SEGMENT_WRITE_KEY}");
  }}();

//- Wire up sharify
if sharify
  != sharify.script()

//- Stripe
if options.stripev3
  script(id="stripe-js", src="https://js.stripe.com/v3/")

//- Analytics & common asset package
if sd.BROWSER && sd.BROWSER.family != 'Other'
  script( src=asset('/assets/analytics.js') )

//- Quantcast
if options.quantcast
  script( type="text/javascript" ).
    var ezt = ezt ||[];
    (function(){
      var elem = document.createElement('script');
      elem.src = (document.location.protocol == "https:" ? "https://secure" : "http://pixel") + ".quantserve.com/aquant.js?a=p-cMwS3F29bthyC";
      elem.async = true;
      elem.type = "text/javascript";
      var scpt = document.getElementsByTagName('script')[0];
      scpt.parentNode.insertBefore(elem,scpt);
    }());
    ezt.push({qacct: 'p-cMwS3F29bthyC', orderid: '', revenue: ''});

  noscript
    img( src="//pixel.quantserve.com/pixel/p-cMwS3F29bthyC.gif?labels=_fp.event.Default" style="display: none;" border="0" height="1" width="1" alt="Quantcast" )

//- Sailthru Horizon JS - user interest data, personalization
if options.sailthru
  if sd.INCLUDE_SAILTHRU
    script( type="text/javascript" ).
      (function() {
        function loadHorizon() {
          var s = document.createElement('script');
          s.type = 'text/javascript';
          s.async = true;
          s.src = location.protocol + '//ak.sail-horizon.com/horizon/v1.js';
          var x = document.getElementsByTagName('script')[0];
          x.parentNode.insertBefore(s, x);
        }
        loadHorizon();
        function loadSailthru() {
          if(typeof Sailthru !== "undefined"){
            Sailthru.setup({
              domain: 'horizon.artsy.net',
              useStoredTags: false
            });
          }
          else{
              setTimeout(loadSailthru, 250);
          }
        }
        var oldOnLoad = window.onload;
        window.onload = function() {
          if (typeof oldOnLoad === 'function') {
            oldOnLoad();
          }
          loadSailthru();
        };
      })();

//- Prefetch links on hover. See: https://instant.page/
if sd.ENABLE_INSTANT_PAGE
  include instant-page

//- Google reCAPTCHA
if options.grecaptcha && sd.RECAPTCHA_KEY && !sd.EIGEN
  script(id="google-recaptcha" src="https://www.google.com/recaptcha/api.js?render=#{sd.RECAPTCHA_KEY}" async defer)
{'fraction_non_alphanumeric': 0.1643835616438356, 'fraction_numerical': 0.005565068493150685, 'mean_word_length': 3.0278735632183906, 'pattern_counts': {'":': 122, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 12, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2889017', 'n_tokens_mistral': 4795, 'n_tokens_neox': 4695, 'n_words': 620}