MattJermyWright
11/14/2019 - 9:22 PM

HPE: Decibel code

HPE: Decibel code

/* global sessionStorage decibelInsight s digitalData utag_data */
(function (s) {
  var enable = false
  try {
    enable = location.hostname.indexOf('www.hpe.com')!==-1 && digitalData.page.pageInfo.technology_stack.indexOf('AEM') > -1
  } catch (e) {}
  if (enable) {
    digitalData.log.info('***Decibel Adobe Integrate: enable detected, starting to execute plugin')
    s.maxDelay = 750
    s.loadModule('Integrate')
    s.Integrate.onLoad = function (s) {
      digitalData.log.info('***Decibel Adobe Integrate: starting integrate onload')
      var eVar = 'eVar127'
      var diPropertyId = '280307'

      if (sessionStorage && sessionStorage._da_da_sessionId) {
        s[eVar] = 'di-' + diPropertyId + '-' + sessionStorage._da_da_sessionId
      } else {
        s.Integrate.add('DecibelInsight')
        s.Integrate.DecibelInsight.sessionVar = eVar
        s.Integrate.DecibelInsight.setVars = function (s, p) {
          if (typeof decibelInsight.getSessionId === 'function') {
            s[p.sessionVar] = decibelInsight.getSessionId()
          }
        }
        if (typeof decibelInsight === 'undefined' || typeof decibelInsight.getSessionId !== 'function') {
          s.Integrate.DecibelInsight.delay()
        }
      }
      digitalData.log.info('***Decibel Adobe Integrate: done integrate onload')
    }
    digitalData.log.info('***Decibel Adobe Integrate: finished with plugin')
  }
})(s)