@mjhls/mjh-framework 1.0.844-schema-fix-v1 → 1.0.844-segment-update-v1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/ArticleProgramLandingPage.js +1 -1
- package/dist/cjs/ArticleSeriesLandingPage.js +2 -2
- package/dist/cjs/DeckContent.js +1 -1
- package/dist/cjs/ExternalResources.js +1 -1
- package/dist/cjs/GridContent.js +2 -2
- package/dist/cjs/HorizontalArticleListing.js +1 -1
- package/dist/cjs/IssueLanding.js +3 -3
- package/dist/cjs/MasterDeck.js +2 -2
- package/dist/cjs/MediaSeriesLanding.js +3 -3
- package/dist/cjs/PartnerDetailListing.js +3 -3
- package/dist/cjs/PubSection.js +2 -2
- package/dist/cjs/QueueDeckExpanded.js +2 -2
- package/dist/cjs/Segment.js +362 -337
- package/dist/cjs/TaxonomyDescription.js +1 -1
- package/dist/cjs/VideoProgramLandingPage.js +1 -1
- package/dist/cjs/VideoSeriesLandingPage.js +2 -2
- package/dist/cjs/View.js +2 -3
- package/dist/cjs/getSerializers.js +1 -1
- package/dist/cjs/index.js +3 -3
- package/dist/esm/ArticleProgramLandingPage.js +1 -1
- package/dist/esm/ArticleSeriesLandingPage.js +2 -2
- package/dist/esm/DeckContent.js +1 -1
- package/dist/esm/ExternalResources.js +1 -1
- package/dist/esm/GridContent.js +2 -2
- package/dist/esm/HorizontalArticleListing.js +1 -1
- package/dist/esm/IssueLanding.js +3 -3
- package/dist/esm/MasterDeck.js +2 -2
- package/dist/esm/MediaSeriesLanding.js +3 -3
- package/dist/esm/PartnerDetailListing.js +3 -3
- package/dist/esm/PubSection.js +2 -2
- package/dist/esm/QueueDeckExpanded.js +2 -2
- package/dist/esm/Segment.js +362 -337
- package/dist/esm/TaxonomyDescription.js +1 -1
- package/dist/esm/VideoProgramLandingPage.js +1 -1
- package/dist/esm/VideoSeriesLandingPage.js +2 -2
- package/dist/esm/View.js +2 -3
- package/dist/esm/getSerializers.js +1 -1
- package/dist/esm/index.js +3 -3
- package/package.json +1 -1
- /package/dist/cjs/{ADInfeed-1417ce9a.js → ADInfeed-25d48cc2.js} +0 -0
- /package/dist/cjs/{ADlgInfeed-01deca1a.js → ADlgInfeed-a535a768.js} +0 -0
- /package/dist/cjs/{index-73ac3122.js → index-ebee04bb.js} +0 -0
- /package/dist/esm/{ADInfeed-bb64ffeb.js → ADInfeed-56a3db8b.js} +0 -0
- /package/dist/esm/{ADlgInfeed-18efe2e7.js → ADlgInfeed-53edb995.js} +0 -0
- /package/dist/esm/{index-e537f766.js → index-29ef9d83.js} +0 -0
package/dist/cjs/Segment.js
CHANGED
|
@@ -9,355 +9,380 @@ require('./core.get-iterator-method-f62321d4.js');
|
|
|
9
9
|
require('./web.dom.iterable-a0e279c1.js');
|
|
10
10
|
var asyncToGenerator = require('./asyncToGenerator-140e5f89.js');
|
|
11
11
|
|
|
12
|
-
require(
|
|
12
|
+
require('babel-polyfill');
|
|
13
13
|
|
|
14
14
|
var Segment = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
identify: function identify(eKey) {
|
|
16
|
+
if (!eKey) {
|
|
17
|
+
throw new Error('eKey is not present');
|
|
18
|
+
}
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
if (typeof analytics === 'undefined') {
|
|
21
|
+
console.error('Segment not initialized', analytics);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
var buff = Buffer.from(eKey, 'base64');
|
|
26
|
+
var email = buff.toString('ascii');
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
analytics.identify(eKey, {
|
|
29
|
+
email: email
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
getURL: function getURL(url) {
|
|
33
|
+
var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
if (!data || !data.needSegmentSupport) {
|
|
36
|
+
return url;
|
|
37
|
+
}
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
if (typeof analytics === 'undefined') {
|
|
40
|
+
console.error('segment not defined');
|
|
41
|
+
return url;
|
|
42
|
+
}
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
if (!analytics || typeof analytics.user !== 'function') {
|
|
45
|
+
console.error('segment not defined: user function');
|
|
46
|
+
return url;
|
|
47
|
+
}
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
var user = analytics.user();
|
|
50
|
+
if (!user) {
|
|
51
|
+
console.log('segment user not defined');
|
|
52
|
+
return url;
|
|
53
|
+
}
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
55
|
+
var anonymouseId = user.anonymousId();
|
|
56
|
+
//const eKey = Beam.proc_eKey(Beam.proc_url())
|
|
57
|
+
var eKey = user._getId();
|
|
58
|
+
if (eKey) {
|
|
59
|
+
url += (url.includes('?') ? '&' : '?') + 'ekey=' + eKey;
|
|
60
|
+
} else {
|
|
61
|
+
url += (url.includes('?') ? '&' : '?') + 'anonymousid=' + anonymouseId;
|
|
62
|
+
}
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
while (1) {
|
|
109
|
-
switch (_context2.prev = _context2.next) {
|
|
110
|
-
case 0:
|
|
111
|
-
if (!(typeof analytics === 'undefined')) {
|
|
112
|
-
_context2.next = 3;
|
|
113
|
-
break;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
console.error('Segment not initialized', window);
|
|
117
|
-
return _context2.abrupt('return');
|
|
118
|
-
|
|
119
|
-
case 3:
|
|
120
|
-
_context2.next = 5;
|
|
121
|
-
return _this2.getIDs();
|
|
122
|
-
|
|
123
|
-
case 5:
|
|
124
|
-
result = _context2.sent;
|
|
125
|
-
beam_id = result.beam_id ? result.beam_id : '';
|
|
126
|
-
session_id = result.session_id ? result.session_id : '';
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
analytics.track('pageviews', {
|
|
130
|
-
beamid: beam_id,
|
|
131
|
-
sessionid: session_id,
|
|
132
|
-
category: '',
|
|
133
|
-
domain: domain
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
case 9:
|
|
137
|
-
case 'end':
|
|
138
|
-
return _context2.stop();
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}, _callee2, _this2);
|
|
142
|
-
}))();
|
|
143
|
-
},
|
|
144
|
-
report_video_event: function report_video_event(action, deviceType, duration, current, segmentData) {
|
|
145
|
-
var videoType = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 'Youtube';
|
|
146
|
-
var brightCovePlayerID = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : '';
|
|
147
|
-
|
|
148
|
-
var _this3 = this;
|
|
149
|
-
|
|
150
|
-
var brightCoveAccountID = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : '';
|
|
151
|
-
var brightCoveVideoID = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : '';
|
|
152
|
-
return asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee3() {
|
|
153
|
-
var result, beam_id, session_id, domain, data;
|
|
154
|
-
return asyncToGenerator.regenerator.wrap(function _callee3$(_context3) {
|
|
155
|
-
while (1) {
|
|
156
|
-
switch (_context3.prev = _context3.next) {
|
|
157
|
-
case 0:
|
|
158
|
-
if (!(typeof analytics === 'undefined')) {
|
|
159
|
-
_context3.next = 3;
|
|
160
|
-
break;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
console.error('Segment not initialized');
|
|
164
|
-
return _context3.abrupt('return');
|
|
165
|
-
|
|
166
|
-
case 3:
|
|
167
|
-
_context3.next = 5;
|
|
168
|
-
return _this3.getIDs();
|
|
169
|
-
|
|
170
|
-
case 5:
|
|
171
|
-
result = _context3.sent;
|
|
172
|
-
beam_id = result.beam_id ? result.beam_id : '';
|
|
173
|
-
session_id = result.session_id ? result.session_id : '';
|
|
174
|
-
domain = typeof window !== 'undefined' && window.location ? window.location.hostname : '';
|
|
175
|
-
data = {
|
|
176
|
-
beamid: beam_id,
|
|
177
|
-
sessionid: session_id,
|
|
178
|
-
domain: domain,
|
|
179
|
-
Devicetype: deviceType,
|
|
180
|
-
videoid: brightCoveVideoID,
|
|
181
|
-
title: '',
|
|
182
|
-
category: '',
|
|
183
|
-
videoplayer: videoType,
|
|
184
|
-
totalduration: duration,
|
|
185
|
-
currentduration: current,
|
|
186
|
-
segment: segmentData,
|
|
187
|
-
queue: Math.floor(duration / 10),
|
|
188
|
-
brightCovePlayerID: brightCovePlayerID,
|
|
189
|
-
brightCoveAccountID: brightCoveAccountID
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
console.log('Segment ' + videoType, action, data);
|
|
194
|
-
|
|
195
|
-
analytics.track(action, data);
|
|
196
|
-
|
|
197
|
-
case 12:
|
|
198
|
-
case 'end':
|
|
199
|
-
return _context3.stop();
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}, _callee3, _this3);
|
|
203
|
-
}))();
|
|
204
|
-
},
|
|
205
|
-
report_ad_event: function report_ad_event(action, deviceType, duration) {
|
|
206
|
-
var adType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'brightcove';
|
|
207
|
-
var adId = arguments[4];
|
|
208
|
-
|
|
209
|
-
var _this4 = this;
|
|
210
|
-
|
|
211
|
-
var brightCovePlayerID = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : '';
|
|
212
|
-
var brightCoveAccountID = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : '';
|
|
213
|
-
return asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee4() {
|
|
214
|
-
var result, beam_id, session_id, domain, data;
|
|
215
|
-
return asyncToGenerator.regenerator.wrap(function _callee4$(_context4) {
|
|
216
|
-
while (1) {
|
|
217
|
-
switch (_context4.prev = _context4.next) {
|
|
218
|
-
case 0:
|
|
219
|
-
if (!(typeof analytics === 'undefined')) {
|
|
220
|
-
_context4.next = 3;
|
|
221
|
-
break;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
console.error('Segment not initialized');
|
|
225
|
-
return _context4.abrupt('return');
|
|
226
|
-
|
|
227
|
-
case 3:
|
|
228
|
-
_context4.next = 5;
|
|
229
|
-
return _this4.getIDs();
|
|
230
|
-
|
|
231
|
-
case 5:
|
|
232
|
-
result = _context4.sent;
|
|
233
|
-
beam_id = result.beam_id ? result.beam_id : '';
|
|
234
|
-
session_id = result.session_id ? result.session_id : '';
|
|
235
|
-
domain = typeof window !== 'undefined' && window.location ? window.location.hostname : '';
|
|
236
|
-
data = {
|
|
237
|
-
beamid: beam_id,
|
|
238
|
-
sessionid: session_id,
|
|
239
|
-
domain: domain,
|
|
240
|
-
Devicetype: deviceType,
|
|
241
|
-
title: '',
|
|
242
|
-
category: '',
|
|
243
|
-
adType: adType,
|
|
244
|
-
totalduration: duration,
|
|
245
|
-
adId: adId,
|
|
246
|
-
brightCovePlayerID: brightCovePlayerID,
|
|
247
|
-
brightCoveAccountID: brightCoveAccountID
|
|
248
|
-
};
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
console.log('Segment ' + adType, action, data);
|
|
252
|
-
|
|
253
|
-
analytics.track(action, data);
|
|
254
|
-
|
|
255
|
-
case 12:
|
|
256
|
-
case 'end':
|
|
257
|
-
return _context4.stop();
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
}, _callee4, _this4);
|
|
261
|
-
}))();
|
|
262
|
-
},
|
|
263
|
-
adClicked: function adClicked(domain, advertiserid, campaignid, creativeid, itemid, size, isemptyline, sourceAgnosticCreativeId, sourceAgnosticlineId) {
|
|
264
|
-
var _this5 = this;
|
|
265
|
-
|
|
266
|
-
return asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee5() {
|
|
267
|
-
var result, beam_id, session_id;
|
|
268
|
-
return asyncToGenerator.regenerator.wrap(function _callee5$(_context5) {
|
|
269
|
-
while (1) {
|
|
270
|
-
switch (_context5.prev = _context5.next) {
|
|
271
|
-
case 0:
|
|
272
|
-
if (!(typeof analytics === 'undefined')) {
|
|
273
|
-
_context5.next = 3;
|
|
274
|
-
break;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
console.error('Segment not initialized');
|
|
278
|
-
return _context5.abrupt('return');
|
|
279
|
-
|
|
280
|
-
case 3:
|
|
281
|
-
_context5.next = 5;
|
|
282
|
-
return _this5.getIDs();
|
|
283
|
-
|
|
284
|
-
case 5:
|
|
285
|
-
result = _context5.sent;
|
|
286
|
-
beam_id = result.beam_id ? result.beam_id : '';
|
|
287
|
-
session_id = result.session_id ? result.session_id : '';
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
analytics.track('Ad Clicked', {
|
|
291
|
-
beamid: beam_id,
|
|
292
|
-
sessionid: session_id,
|
|
293
|
-
advertiserid: advertiserid,
|
|
294
|
-
campaignid: campaignid,
|
|
295
|
-
creativeid: creativeid,
|
|
296
|
-
itemid: itemid,
|
|
297
|
-
size: size,
|
|
298
|
-
isemptyline: isemptyline,
|
|
299
|
-
sourceAgnosticCreativeId: sourceAgnosticCreativeId,
|
|
300
|
-
sourceAgnosticlineId: sourceAgnosticlineId,
|
|
301
|
-
domain: domain
|
|
302
|
-
});
|
|
303
|
-
|
|
304
|
-
case 9:
|
|
305
|
-
case 'end':
|
|
306
|
-
return _context5.stop();
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
}, _callee5, _this5);
|
|
310
|
-
}))();
|
|
311
|
-
},
|
|
312
|
-
adViewed: function adViewed(domain, advertiserid, campaignid, creativeid, itemid, size, isemptyline, sourceAgnosticCreativeId, sourceAgnosticlineId) {
|
|
313
|
-
var _this6 = this;
|
|
314
|
-
|
|
315
|
-
return asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee6() {
|
|
316
|
-
var result, beam_id, session_id;
|
|
317
|
-
return asyncToGenerator.regenerator.wrap(function _callee6$(_context6) {
|
|
318
|
-
while (1) {
|
|
319
|
-
switch (_context6.prev = _context6.next) {
|
|
320
|
-
case 0:
|
|
321
|
-
if (!(typeof analytics === 'undefined')) {
|
|
322
|
-
_context6.next = 3;
|
|
323
|
-
break;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
console.error('Segment not initialized');
|
|
327
|
-
return _context6.abrupt('return');
|
|
328
|
-
|
|
329
|
-
case 3:
|
|
330
|
-
_context6.next = 5;
|
|
331
|
-
return _this6.getIDs();
|
|
332
|
-
|
|
333
|
-
case 5:
|
|
334
|
-
result = _context6.sent;
|
|
335
|
-
beam_id = result.beam_id ? result.beam_id : '';
|
|
336
|
-
session_id = result.session_id ? result.session_id : '';
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
analytics.track('Impression Viewed', {
|
|
340
|
-
beamid: beam_id,
|
|
341
|
-
sessionid: session_id,
|
|
342
|
-
advertiserid: advertiserid,
|
|
343
|
-
campaignid: campaignid,
|
|
344
|
-
creativeid: creativeid,
|
|
345
|
-
itemid: itemid,
|
|
346
|
-
size: size,
|
|
347
|
-
isemptyline: isemptyline,
|
|
348
|
-
sourceAgnosticCreativeId: sourceAgnosticCreativeId,
|
|
349
|
-
sourceAgnosticlineId: sourceAgnosticlineId,
|
|
350
|
-
domain: domain
|
|
351
|
-
});
|
|
352
|
-
|
|
353
|
-
case 9:
|
|
354
|
-
case 'end':
|
|
355
|
-
return _context6.stop();
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
}, _callee6, _this6);
|
|
359
|
-
}))();
|
|
64
|
+
return url;
|
|
65
|
+
},
|
|
66
|
+
getIDs: function getIDs() {
|
|
67
|
+
var _this = this;
|
|
68
|
+
|
|
69
|
+
return asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee() {
|
|
70
|
+
var res, json;
|
|
71
|
+
return asyncToGenerator.regenerator.wrap(function _callee$(_context) {
|
|
72
|
+
while (1) {
|
|
73
|
+
switch (_context.prev = _context.next) {
|
|
74
|
+
case 0:
|
|
75
|
+
_context.next = 2;
|
|
76
|
+
return fetch('https://beam.mjhlifesciences.com/api/beam/id', {
|
|
77
|
+
headers: {
|
|
78
|
+
'Content-Type': 'application/json',
|
|
79
|
+
Accept: 'application/json'
|
|
80
|
+
},
|
|
81
|
+
method: 'post',
|
|
82
|
+
credentials: 'include'
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
case 2:
|
|
86
|
+
res = _context.sent;
|
|
87
|
+
_context.next = 5;
|
|
88
|
+
return res.json();
|
|
89
|
+
|
|
90
|
+
case 5:
|
|
91
|
+
json = _context.sent;
|
|
92
|
+
return _context.abrupt('return', json);
|
|
93
|
+
|
|
94
|
+
case 7:
|
|
95
|
+
case 'end':
|
|
96
|
+
return _context.stop();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}, _callee, _this);
|
|
100
|
+
}))();
|
|
101
|
+
},
|
|
102
|
+
getMeta: function getMeta(metaName) {
|
|
103
|
+
var metas = document.getElementsByTagName('meta');
|
|
104
|
+
for (var i = 0; i < metas.length; i++) {
|
|
105
|
+
if (metas[i].getAttribute('name') === metaName) {
|
|
106
|
+
return metas[i].getAttribute('content');
|
|
107
|
+
}
|
|
360
108
|
}
|
|
109
|
+
|
|
110
|
+
return '';
|
|
111
|
+
},
|
|
112
|
+
pageview: function pageview(domain) {
|
|
113
|
+
var _this2 = this;
|
|
114
|
+
|
|
115
|
+
return asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee2() {
|
|
116
|
+
var result, beam_id, session_id;
|
|
117
|
+
return asyncToGenerator.regenerator.wrap(function _callee2$(_context2) {
|
|
118
|
+
while (1) {
|
|
119
|
+
switch (_context2.prev = _context2.next) {
|
|
120
|
+
case 0:
|
|
121
|
+
if (!(typeof analytics === 'undefined')) {
|
|
122
|
+
_context2.next = 3;
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
console.error('Segment not initialized', window);
|
|
127
|
+
return _context2.abrupt('return');
|
|
128
|
+
|
|
129
|
+
case 3:
|
|
130
|
+
_context2.next = 5;
|
|
131
|
+
return _this2.getIDs();
|
|
132
|
+
|
|
133
|
+
case 5:
|
|
134
|
+
result = _context2.sent;
|
|
135
|
+
beam_id = result.beam_id ? result.beam_id : '';
|
|
136
|
+
session_id = result.session_id ? result.session_id : '';
|
|
137
|
+
|
|
138
|
+
analytics.page({
|
|
139
|
+
keywords: _this2.getMeta('keywords')
|
|
140
|
+
});
|
|
141
|
+
analytics.track('pageviews', {
|
|
142
|
+
beamid: beam_id,
|
|
143
|
+
sessionid: session_id,
|
|
144
|
+
category: '',
|
|
145
|
+
domain: domain,
|
|
146
|
+
keywords: _this2.getMeta('keywords')
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
case 10:
|
|
150
|
+
case 'end':
|
|
151
|
+
return _context2.stop();
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}, _callee2, _this2);
|
|
155
|
+
}))();
|
|
156
|
+
},
|
|
157
|
+
report_video_event: function report_video_event(action, deviceType, duration, current, segmentData) {
|
|
158
|
+
var videoType = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 'Youtube';
|
|
159
|
+
var brightCovePlayerID = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : '';
|
|
160
|
+
|
|
161
|
+
var _this3 = this;
|
|
162
|
+
|
|
163
|
+
var brightCoveAccountID = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : '';
|
|
164
|
+
var brightCoveVideoID = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : '';
|
|
165
|
+
return asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee3() {
|
|
166
|
+
var result, beam_id, session_id, domain, data;
|
|
167
|
+
return asyncToGenerator.regenerator.wrap(function _callee3$(_context3) {
|
|
168
|
+
while (1) {
|
|
169
|
+
switch (_context3.prev = _context3.next) {
|
|
170
|
+
case 0:
|
|
171
|
+
if (!(typeof analytics === 'undefined')) {
|
|
172
|
+
_context3.next = 3;
|
|
173
|
+
break;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
console.error('Segment not initialized');
|
|
177
|
+
return _context3.abrupt('return');
|
|
178
|
+
|
|
179
|
+
case 3:
|
|
180
|
+
_context3.next = 5;
|
|
181
|
+
return _this3.getIDs();
|
|
182
|
+
|
|
183
|
+
case 5:
|
|
184
|
+
result = _context3.sent;
|
|
185
|
+
beam_id = result.beam_id ? result.beam_id : '';
|
|
186
|
+
session_id = result.session_id ? result.session_id : '';
|
|
187
|
+
domain = typeof window !== 'undefined' && window.location ? window.location.hostname : '';
|
|
188
|
+
data = {
|
|
189
|
+
beamid: beam_id,
|
|
190
|
+
sessionid: session_id,
|
|
191
|
+
domain: domain,
|
|
192
|
+
Devicetype: deviceType,
|
|
193
|
+
videoid: brightCoveVideoID,
|
|
194
|
+
title: '',
|
|
195
|
+
category: '',
|
|
196
|
+
videoplayer: videoType,
|
|
197
|
+
totalduration: duration,
|
|
198
|
+
currentduration: current,
|
|
199
|
+
segment: segmentData,
|
|
200
|
+
queue: Math.floor(duration / 10),
|
|
201
|
+
brightCovePlayerID: brightCovePlayerID,
|
|
202
|
+
brightCoveAccountID: brightCoveAccountID,
|
|
203
|
+
keywords: _this3.getMeta('keywords')
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
console.log('Segment ' + videoType, action, data);
|
|
208
|
+
analytics.page({
|
|
209
|
+
keywords: _this3.getMeta('keywords')
|
|
210
|
+
});
|
|
211
|
+
analytics.track(action, data);
|
|
212
|
+
|
|
213
|
+
case 13:
|
|
214
|
+
case 'end':
|
|
215
|
+
return _context3.stop();
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}, _callee3, _this3);
|
|
219
|
+
}))();
|
|
220
|
+
},
|
|
221
|
+
report_ad_event: function report_ad_event(action, deviceType, duration) {
|
|
222
|
+
var adType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'brightcove';
|
|
223
|
+
var adId = arguments[4];
|
|
224
|
+
|
|
225
|
+
var _this4 = this;
|
|
226
|
+
|
|
227
|
+
var brightCovePlayerID = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : '';
|
|
228
|
+
var brightCoveAccountID = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : '';
|
|
229
|
+
return asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee4() {
|
|
230
|
+
var result, beam_id, session_id, domain, data;
|
|
231
|
+
return asyncToGenerator.regenerator.wrap(function _callee4$(_context4) {
|
|
232
|
+
while (1) {
|
|
233
|
+
switch (_context4.prev = _context4.next) {
|
|
234
|
+
case 0:
|
|
235
|
+
if (!(typeof analytics === 'undefined')) {
|
|
236
|
+
_context4.next = 3;
|
|
237
|
+
break;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
console.error('Segment not initialized');
|
|
241
|
+
return _context4.abrupt('return');
|
|
242
|
+
|
|
243
|
+
case 3:
|
|
244
|
+
_context4.next = 5;
|
|
245
|
+
return _this4.getIDs();
|
|
246
|
+
|
|
247
|
+
case 5:
|
|
248
|
+
result = _context4.sent;
|
|
249
|
+
beam_id = result.beam_id ? result.beam_id : '';
|
|
250
|
+
session_id = result.session_id ? result.session_id : '';
|
|
251
|
+
domain = typeof window !== 'undefined' && window.location ? window.location.hostname : '';
|
|
252
|
+
data = {
|
|
253
|
+
beamid: beam_id,
|
|
254
|
+
sessionid: session_id,
|
|
255
|
+
domain: domain,
|
|
256
|
+
Devicetype: deviceType,
|
|
257
|
+
title: '',
|
|
258
|
+
category: '',
|
|
259
|
+
adType: adType,
|
|
260
|
+
totalduration: duration,
|
|
261
|
+
adId: adId,
|
|
262
|
+
brightCovePlayerID: brightCovePlayerID,
|
|
263
|
+
brightCoveAccountID: brightCoveAccountID,
|
|
264
|
+
keywords: _this4.getMeta('keywords')
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
console.log('Segment ' + adType, action, data);
|
|
269
|
+
analytics.page({
|
|
270
|
+
keywords: _this4.getMeta('keywords')
|
|
271
|
+
});
|
|
272
|
+
analytics.track(action, data);
|
|
273
|
+
|
|
274
|
+
case 13:
|
|
275
|
+
case 'end':
|
|
276
|
+
return _context4.stop();
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}, _callee4, _this4);
|
|
280
|
+
}))();
|
|
281
|
+
},
|
|
282
|
+
adClicked: function adClicked(domain, advertiserid, campaignid, creativeid, itemid, size, isemptyline, sourceAgnosticCreativeId, sourceAgnosticlineId) {
|
|
283
|
+
var _this5 = this;
|
|
284
|
+
|
|
285
|
+
return asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee5() {
|
|
286
|
+
var result, beam_id, session_id;
|
|
287
|
+
return asyncToGenerator.regenerator.wrap(function _callee5$(_context5) {
|
|
288
|
+
while (1) {
|
|
289
|
+
switch (_context5.prev = _context5.next) {
|
|
290
|
+
case 0:
|
|
291
|
+
if (!(typeof analytics === 'undefined')) {
|
|
292
|
+
_context5.next = 3;
|
|
293
|
+
break;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
console.error('Segment not initialized');
|
|
297
|
+
return _context5.abrupt('return');
|
|
298
|
+
|
|
299
|
+
case 3:
|
|
300
|
+
_context5.next = 5;
|
|
301
|
+
return _this5.getIDs();
|
|
302
|
+
|
|
303
|
+
case 5:
|
|
304
|
+
result = _context5.sent;
|
|
305
|
+
beam_id = result.beam_id ? result.beam_id : '';
|
|
306
|
+
session_id = result.session_id ? result.session_id : '';
|
|
307
|
+
|
|
308
|
+
analytics.page({
|
|
309
|
+
keywords: _this5.getMeta('keywords')
|
|
310
|
+
});
|
|
311
|
+
analytics.track('Ad Clicked', {
|
|
312
|
+
beamid: beam_id,
|
|
313
|
+
sessionid: session_id,
|
|
314
|
+
advertiserid: advertiserid,
|
|
315
|
+
campaignid: campaignid,
|
|
316
|
+
creativeid: creativeid,
|
|
317
|
+
itemid: itemid,
|
|
318
|
+
size: size,
|
|
319
|
+
isemptyline: isemptyline,
|
|
320
|
+
sourceAgnosticCreativeId: sourceAgnosticCreativeId,
|
|
321
|
+
sourceAgnosticlineId: sourceAgnosticlineId,
|
|
322
|
+
domain: domain,
|
|
323
|
+
keywords: _this5.getMeta('keywords')
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
case 10:
|
|
327
|
+
case 'end':
|
|
328
|
+
return _context5.stop();
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}, _callee5, _this5);
|
|
332
|
+
}))();
|
|
333
|
+
},
|
|
334
|
+
adViewed: function adViewed(domain, advertiserid, campaignid, creativeid, itemid, size, isemptyline, sourceAgnosticCreativeId, sourceAgnosticlineId) {
|
|
335
|
+
var _this6 = this;
|
|
336
|
+
|
|
337
|
+
return asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee6() {
|
|
338
|
+
var result, beam_id, session_id;
|
|
339
|
+
return asyncToGenerator.regenerator.wrap(function _callee6$(_context6) {
|
|
340
|
+
while (1) {
|
|
341
|
+
switch (_context6.prev = _context6.next) {
|
|
342
|
+
case 0:
|
|
343
|
+
if (!(typeof analytics === 'undefined')) {
|
|
344
|
+
_context6.next = 3;
|
|
345
|
+
break;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
console.error('Segment not initialized');
|
|
349
|
+
return _context6.abrupt('return');
|
|
350
|
+
|
|
351
|
+
case 3:
|
|
352
|
+
_context6.next = 5;
|
|
353
|
+
return _this6.getIDs();
|
|
354
|
+
|
|
355
|
+
case 5:
|
|
356
|
+
result = _context6.sent;
|
|
357
|
+
beam_id = result.beam_id ? result.beam_id : '';
|
|
358
|
+
session_id = result.session_id ? result.session_id : '';
|
|
359
|
+
|
|
360
|
+
analytics.page({
|
|
361
|
+
keywords: _this6.getMeta('keywords')
|
|
362
|
+
});
|
|
363
|
+
analytics.track('Impression Viewed', {
|
|
364
|
+
beamid: beam_id,
|
|
365
|
+
sessionid: session_id,
|
|
366
|
+
advertiserid: advertiserid,
|
|
367
|
+
campaignid: campaignid,
|
|
368
|
+
creativeid: creativeid,
|
|
369
|
+
itemid: itemid,
|
|
370
|
+
size: size,
|
|
371
|
+
isemptyline: isemptyline,
|
|
372
|
+
sourceAgnosticCreativeId: sourceAgnosticCreativeId,
|
|
373
|
+
sourceAgnosticlineId: sourceAgnosticlineId,
|
|
374
|
+
domain: domain,
|
|
375
|
+
keywords: _this6.getMeta('keywords')
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
case 10:
|
|
379
|
+
case 'end':
|
|
380
|
+
return _context6.stop();
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
}, _callee6, _this6);
|
|
384
|
+
}))();
|
|
385
|
+
}
|
|
361
386
|
};
|
|
362
387
|
|
|
363
388
|
module.exports = Segment;
|