PageSourceSearch

https://hrexecutive.com/js/olytics_dfp.js

js hrexecutive.com collected 2026-10-02 02:19:47 UTC 4,197 bytes, 147 lines download raw bytes

1/* eslint-disable no-unused-vars */
2/* eslint-disable no-undef */
3/* eslint-disable camelcase */
4// Olytics 3.0 Loader
5window.olytics || (window.olytics = [])
6window.olytics.methods = ['fire', 'confirm']
7window.olytics.factory = function (i) {
8  return function () {
9    const t = Array.prototype.slice.call(arguments)
10    t.unshift(i)
11    window.olytics.push(t)
12    return window.olytics
13  }
14}
15for (let i = 0; i < window.olytics.methods.length; i++) {
16  const method = window.olytics.methods[i]
17  window.olytics[method] = window.olytics.factory(method)
18}
19
20olytics.load = function (i) {
21  if (!document.getElementById('olyticsImport')) {
22    window.a = window.olytics
23    const t = document.createElement('script')
24    t.async = true
25    t.id = 'olyticsImport'
26    t.type = 'text/javascript'
27    let o = ''
28    if (i && i.oid) o = i.oid
29    t.setAttribute('data-oid', o)
30    t.src = 'https://olytics.omeda.com/olytics/js/v3/p/olytics.min.js'
31    t.addEventListener(
32      'load',
33      function () {
34        olytics.initialize({ Olytics: i })
35        while (window.a.length > 0) {
36          const o = window.a.shift()
37          const s = o.shift()
38          if (olytics[s]) olytics[s].apply(olytics, o)
39        }
40      },
41      false,
42    )
43    const s = document.getElementsByTagName('script')[0]
44    s.parentNode.insertBefore(t, s)
45  }
46}
47
48// Initialize with OID
49olytics.load({ oid: '1ffb93c05f344c0c91be20c7e7376a94' })
50
51// Meta Tag Processing
52const metas = document.getElementsByTagName('meta')
53let olyticsTag = ''
54let olyticsCategory = ''
55let olyticsId = ''
56
57if (window.location.href.includes('hrexecutive')) {
58  olyticsId = '2672C9123356A8B'
59  olyticsCategory = 'HR'
60}
61
62// Loop through meta tags
63if (metas && metas.length > 0) {
64  for (let i = 0; i < metas.length; i++) {
65    const meta = metas[i]
66    const nameAttr = meta.getAttribute('name')
67
68    if (nameAttr && nameAttr === 'olyticsCategory' && meta.getAttribute('content')) {
69      olyticsCategory = meta.getAttribute('content')
70    } else if (nameAttr && nameAttr === 'sailthru.tags' && meta.getAttribute('content')) {
71      olyticsTag = meta.getAttribute('content')
72
73      if (!olyticsTag.includes('free') && !olyticsTag.includes('premium')) {
74        if (olyticsTag !== '') {
75          olyticsTag += ','
76        }
77        olyticsTag += 'article'
78      }
79    }
80  }
81
82  if (olyticsTag.length > 0) {
83    olytics.fire({
84      behaviorId: olyticsId,
85      category: olyticsCategory,
86      tag: olyticsTag,
87    })
88  } else {
89    olytics.fire({
90      behaviorId: olyticsId,
91      category: olyticsCategory,
92    })
93  }
94
95  if (window.olytics?.nextPageView) {
96    window.olytics.nextPageView()
97  }
98}
99
100// Once Olytics global import loads
101document.querySelector('#olyticsImport').addEventListener('load', function () {
102  window.olytics.loadDfpSegments()
103})
104
105// simple method to set a cookie – you may have your own already.
106const olyDfpSetCookie = function (name, value, minutes) {
107  let expires
108  if (minutes) {
109    const date = new Date()
110    date.setTime(date.getTime() + minutes * 60 * 1000)
111    expires = '; expires=' + date.toGMTString()
112  } else {
113    expires = ''
114  }
115  document.cookie = name + '=' + value + expires + '; path=/'
116}
117// grabs the olytics cookie that contains the GAM key/value pairs.
118function olyDfpGrabCookie() {
119  if (document.cookie.length > 0) {
120    const c_name = 'olytics_dfp_keys'
121    let c_start = document.cookie.indexOf(c_name + '=')
122    if (c_start !== -1) {
123      c_start = c_start + c_name.length + 1
124      let c_end = document.cookie.indexOf(';', c_start)
125      if (c_end === -1) {
126        c_end = document.cookie.length
127      }
128      return unescape(document.cookie.substring(c_start, c_end))
129    }
130  }
131  return ''
132}
133
134// Page load: grab key/value pairs from the cookie
135const olyCDFP = olyDfpGrabCookie()
136
137// Olytics will execute this function
138window.olyticsDfpSegments = function (olyPayload) {
139  const olyTSString = JSON.stringify(olyPayload)
140  olyDfpSetCookie('olytics_dfp_keys', olyTSString, 1)
141}
142
143// Include Olytics CSS
144const olyCss = document.createElement('link')
145olyCss.rel = 'stylesheet'
146olyCss.href = 'https://olytics.omeda.com/olytics/css/v3/p/olytics.css'
147document.head.appendChild(olyCss)

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.