<commit_before><script>
/*
===================================
| DATALAYER ARCHITECTURE: SHOPIFY |
-----------------------------------

DEFINITION:
A data layer helps you collect more accurate analytics data, that in turn allows you to better understand what potential buyers are doing on your website and where you can make improvements. It also reduces the time to implement marketing tags on a website, and reduces the need for IT involvement, leaving them to get on with implementing new features and fixing bugs.

RESOURCES:
http://www.datalayerdoctor.com/a-gentle-introduction-to-the-data-layer-for-digital-marketers/
http://www.simoahava.com/analytics/data-layer/

AUTHORS:
<NAME> = [{
Email: <EMAIL>,
Website: mechellewarneke.com,
BVACCEL: [{
    Email: <EMAIL>,
    Position: XO Strategist | Technical Web Analyst
}]
}];

<NAME> = [{
Website: tylershambora.com,
BVACCEL: [{
    Email: <EMAIL>,
    Position: Lead Web Developer
}]
}];

EXTERNAL DEPENDENCIES:
* jQuery
* jQuery Cookie Plugin v1.4.1 - https://github.com/carhartl/jquery-cookie
* cartjs - https://github.com/discolabs/cartjs

DataLayer Architecture: Shopify v1.3.1
COPYRIGHT 2016
LICENSES: MIT ( https://opensource.org/licenses/MIT )
*/

/* =======================
| PREREQUISITE LIBRARIES |
----------------------- */

// jquery-cookies.js

/* =====================
| DYNAMIC DEPENDENCIES |
--------------------- */

bvaDataLayerConfig = {
  dynamicCart: true,  // if cart is dynamic (meaning no refresh on cart add) set to true
  cartTriggers: ['.cart-link'],
  cartVisableSelector: ['.mfp-cart'],
  promoSubscriptionsSelectors: [],
  ctaSelectors: ['[data-cta]'],
  debug: true,
  cart: null
};

jQuery.getJSON('/cart.js', function (response) {
  bvaDataLayerConfig.cart = response;
});


/* ======================
| Begin dataLayer Build |
---------------------- */

window.dataLayer = window.dataLayer || [];  // init data layer if doesn't already exist
var template = '{{ template }}';

if (bvaDataLayerConfig.debug) {
  console.log('----------------------\nBEGIN DATALAYER BUILD\nTHEME PAGES\n----------------------');
  console.log('Page Template: {{ template }}');
}


/* Landing Page Cookie
-----------------------
1. Detect if user just landed on the site
2. Only fires if Page Title matches website */

$.cookie.raw = true;
if ($.cookie('landingPage') === undefined || $.cookie('landingPage').length === 0) {
  var landingPage = true;
  $.cookie('landingPage', unescape);
  $.removeCookie('landingPage', {path: '/'});
  $.cookie('landingPage', 'landed', {path: '/'});
} else {
  var landingPage = false;
  $.cookie('landingPage', unescape);
  $.removeCookie('landingPage', {path: '/'});
  $.cookie('landingPage', 'refresh', {path: '/'});
}
if (bvaDataLayerConfig.debug) {
  console.log('Landing Page: ' + landingPage);
}


/* Log State Cookie
------------------- */

{% if customer %}
var isLoggedIn = true;
{% else %}
var isLoggedIn = false;
{% endif %}
if (!isLoggedIn) {
  $.cookie('logState', unescape);
  $.removeCookie('logState', {path: '/'});
  $.cookie('logState', 'loggedOut', {path: '/'});
} else {
  if ($.cookie('logState') === 'loggedOut' || $.cookie('logState') === undefined) {
    $.cookie('logState', unescape);
    $.removeCookie('logState', {path: '/'});
    $.cookie('logState', 'firstLog', {path: '/'});
  } else if ($.cookie('logState') === 'firstLog') {
    $.cookie('logState', unescape);
    $.removeCookie('logState', {path: '/'});
    $.cookie('logState', 'refresh', {path: '/'});
  }
}

if ($.cookie('logState') === 'firstLog') {
  var firstLog = true;
} else {
  var firstLog = false;
}
if (bvaDataLayerConfig.debug) {
  console.log('Logged In: ' + isLoggedIn + '\nFirst Log: ' + firstLog);
}

/* ==========
| DATALAYERS |
----------- */

if (bvaDataLayerConfig.debug) {
  console.log('==============\n| DATALAYERS |\n--------------')
  console.log("Timestamp: " + Date.now());
}

/* DATALAYER: Landing Page
--------------------------
Fires any time a user first lands on the site. */

if ($.cookie('landingPage') === 'landed') {
  dataLayer.push({
    'pageType': 'Landing Page',
    'event': 'Landing Page'
  });
  if (bvaDataLayerConfig.debug) {
    console.log('DATALAYER: Landing Page fired.');
  }
}


/* DATALAYER: Log State
-----------------------
1. Determine if user is logged in or not.
2. Return User specific data. */

dataLayer.push({
  {% if shop.customer_accounts_enabled %}
  {% if customer %}
  'userId': '{{customer.id}}',
  'customerEmail': '{{customer.email}}',
  'logState': 'Logged In',
  {% else %}
  'logState': 'Logged Out',
  {% endif %}
  {% endif %}
  'firstLog': firstLog,
  'clientId': cid[0],
  'customerEmail': '{{customer.email}}',
  'timestamp': Date.now()
}, {'event': 'Log State'});
if (bvaDataLayerConfig.debug) {
  console.log('DATALAYER: Log State fired.');
}

/*mDATALAYER: Blog Articles
---------------------------
Fire on Blog Article Pages */

{% if template contains 'article' %}
dataLayer.push({<commit_msg>Removed cid vars in script<commit_after><script>
/*
===================================
| DATALAYER ARCHITECTURE: SHOPIFY |
-----------------------------------

DEFINITION:
A data layer helps you collect more accurate analytics data, that in turn allows you to better understand what potential buyers are doing on your website and where you can make improvements. It also reduces the time to implement marketing tags on a website, and reduces the need for IT involvement, leaving them to get on with implementing new features and fixing bugs.

RESOURCES:
http://www.datalayerdoctor.com/a-gentle-introduction-to-the-data-layer-for-digital-marketers/
http://www.simoahava.com/analytics/data-layer/

AUTHORS:
<NAME> = [{
Email: <EMAIL>,
Website: mechellewarneke.com,
BVACCEL: [{
    Email: <EMAIL>,
    Position: XO Strategist | Technical Web Analyst
}]
}];

<NAME> = [{
Website: tylershambora.com,
BVACCEL: [{
    Email: <EMAIL>,
    Position: Lead Web Developer
}]
}];

EXTERNAL DEPENDENCIES:
* jQuery
* jQuery Cookie Plugin v1.4.1 - https://github.com/carhartl/jquery-cookie
* cartjs - https://github.com/discolabs/cartjs

DataLayer Architecture: Shopify v1.3.1
COPYRIGHT 2016
LICENSES: MIT ( https://opensource.org/licenses/MIT )
*/

/* =======================
| PREREQUISITE LIBRARIES |
----------------------- */

// jquery-cookies.js

/* =====================
| DYNAMIC DEPENDENCIES |
--------------------- */

bvaDataLayerConfig = {
  dynamicCart: true,  // if cart is dynamic (meaning no refresh on cart add) set to true
  cartTriggers: ['.cart-link'],
  cartVisableSelector: ['.mfp-cart'],
  promoSubscriptionsSelectors: [],
  ctaSelectors: ['[data-cta]'],
  debug: true,
  cart: null
};

jQuery.getJSON('/cart.js', function (response) {
  bvaDataLayerConfig.cart = response;
});


/* ======================
| Begin dataLayer Build |
---------------------- */

window.dataLayer = window.dataLayer || [];  // init data layer if doesn't already exist
var template = '{{ template }}';

if (bvaDataLayerConfig.debug) {
  console.log('----------------------\nBEGIN DATALAYER BUILD\nTHEME PAGES\n----------------------');
  console.log('Page Template: {{ template }}');
}


/* Landing Page Cookie
-----------------------
1. Detect if user just landed on the site
2. Only fires if Page Title matches website */

$.cookie.raw = true;
if ($.cookie('landingPage') === undefined || $.cookie('landingPage').length === 0) {
  var landingPage = true;
  $.cookie('landingPage', unescape);
  $.removeCookie('landingPage', {path: '/'});
  $.cookie('landingPage', 'landed', {path: '/'});
} else {
  var landingPage = false;
  $.cookie('landingPage', unescape);
  $.removeCookie('landingPage', {path: '/'});
  $.cookie('landingPage', 'refresh', {path: '/'});
}
if (bvaDataLayerConfig.debug) {
  console.log('Landing Page: ' + landingPage);
}


/* Log State Cookie
------------------- */

{% if customer %}
var isLoggedIn = true;
{% else %}
var isLoggedIn = false;
{% endif %}
if (!isLoggedIn) {
  $.cookie('logState', unescape);
  $.removeCookie('logState', {path: '/'});
  $.cookie('logState', 'loggedOut', {path: '/'});
} else {
  if ($.cookie('logState') === 'loggedOut' || $.cookie('logState') === undefined) {
    $.cookie('logState', unescape);
    $.removeCookie('logState', {path: '/'});
    $.cookie('logState', 'firstLog', {path: '/'});
  } else if ($.cookie('logState') === 'firstLog') {
    $.cookie('logState', unescape);
    $.removeCookie('logState', {path: '/'});
    $.cookie('logState', 'refresh', {path: '/'});
  }
}

if ($.cookie('logState') === 'firstLog') {
  var firstLog = true;
} else {
  var firstLog = false;
}
if (bvaDataLayerConfig.debug) {
  console.log('Logged In: ' + isLoggedIn + '\nFirst Log: ' + firstLog);
}

/* ==========
| DATALAYERS |
----------- */

if (bvaDataLayerConfig.debug) {
  console.log('==============\n| DATALAYERS |\n--------------')
  console.log("Timestamp: " + Date.now());
}

/* DATALAYER: Landing Page
--------------------------
Fires any time a user first lands on the site. */

if ($.cookie('landingPage') === 'landed') {
  dataLayer.push({
    'pageType': 'Landing Page',
    'event': 'Landing Page'
  });
  if (bvaDataLayerConfig.debug) {
    console.log('DATALAYER: Landing Page fired.');
  }
}


/* DATALAYER: Log State
-----------------------
1. Determine if user is logged in or not.
2. Return User specific data. */

dataLayer.push({
  {% if shop.customer_accounts_enabled %}
  {% if customer %}
  'userId': '{{customer.id}}',
  'customerEmail': '{{customer.email}}',
  'logState': 'Logged In',
  {% else %}
  'logState': 'Logged Out',
  {% endif %}
  {% endif %}
  'firstLog': firstLog,
  'customerEmail': '{{customer.email}}',
  'timestamp': Date.now()
}, {'event': 'Log State'});
if (bvaDataLayerConfig.debug) {
  console.log('DATALAYER: Log State fired.');
}

/*mDATALAYER: Blog Articles
---------------------------
Fire on Blog Article Pages */

{% if template contains 'article' %}
dataLayer.push({
{'fraction_non_alphanumeric': 0.24806045340050378, 'fraction_numerical': 0.003123425692695214, 'mean_word_length': 3.1723413198823036, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 6, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6113400', 'n_tokens_mistral': 3292, 'n_tokens_neox': 3159, 'n_words': 791}