-
Notifications
You must be signed in to change notification settings - Fork 0
/
dx_upx_0DPKjoICb7.js
271 lines (245 loc) · 10 KB
/
dx_upx_0DPKjoICb7.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
(function() {
var UST_NAME = 'dx_upx_0DPKjoICb7.js';
var CONSENT_PARAMETER = 'cs';
/** get the value of any key passed to a query string that links this script *
* E.G <script type='text/javascript' src='cti.w55c.net/ct/dx_upx_0DAbt8AQLM.js?dx_UST_stage=TD_[stage]&dx_UST_model=[model]'></script>
*/
var getScriptLinkQueryParameters = function (name) {
var scripts = document.getElementsByTagName('script');
var dxScript = '';
var scriptTokens = [];
for (var i = 0; i < scripts.length; i++) {
if (scripts[i].src && scripts[i].src.indexOf(UST_NAME) > -1) {
dxScript = scripts[i];
scriptTokens = dxScript.src.toLowerCase().split('?');
if (scriptTokens.length > 1) {
break;
}
}
}
if (dxScript === '' || scriptTokens.length < 2) {
return '';
}
var scriptQueryString = scriptTokens[1];
var queryStringValues = scriptQueryString.split('&');
for (var i = 0; i < queryStringValues.length; i++) {
if (queryStringValues[i].indexOf(name.toLowerCase())!= -1) {
return queryStringValues[i].split('=')[1];
}
}
return '';
};
/*
* firePixel()
* V3.
* This version adds functionality so that now you can check
* whether the wfivefivec cookie is set, and you can also specify
* the names of other cookies to be set on the cti.w55c.net domain.
* This version creates an iframe which sources some html
* and javascript hosted on http://cti.w55c.net.
*
* @param <String> pixelIds - the pixel pixel ids to fire, comma seperated.
* @param <Boolean> checkCookie - whether to only fire the pixel if the wfivefivec cookie is set.
* @param <String> setCookies - an array of names of cookies to set.
* @see https://github.com/dataxu/ust/blob/master/html/cookie-pixel-fire.html
*/
var firePixel = function(checkCookie, setCookies) {
// Serve the Iframe from the secure or regular w55c domains depending on sourced protocol
var iframeDomain = '//cti.w55c.net';
var iframeUrl = iframeDomain + '/ct/cookie-pixel-fire-sap.html';
var iframe = document.createElement('iframe');
var iframeSrc = iframeUrl + '?check_cookie=';
iframeSrc += checkCookie ? 'true' : 'false';
// If there are cookies in the cookieSet array put them into the query string
// with comma delimiters
if(setCookies && setCookies.length > 0) {
var cookieList = setCookies[0];
for(var i = 1; i < setCookies.length; i++) {
cookieList += ',' + setCookies[i];
}
iframeSrc += '&set_cookies=' + cookieList;
}
// Added to make sure #hashtag are included in URLs passed to this iframe
var hashtag = window.location.hash;
if( hashtag !== "" ){
iframeSrc += "&loc_hashtag=" + encodeURIComponent(hashtag); // '#' must be encoded
}
var consentStringValue = getScriptLinkQueryParameters(CONSENT_PARAMETER);
if(consentStringValue != ''){
iframeSrc += '&cs=' + consentStringValue;
}
iframe.setAttribute('src', iframeSrc);
iframe.style.width = '1px';
iframe.style.height = '1px';
iframe.style.display = "none";
iframe.style.visibility = "hidden";
document.body.appendChild(iframe);
};
/** Return true if the URL contains any of the URIs in the countryURIs array */
var urlContainsCountryUri = function() {
for(var i = 0; i < countryUris.length; i++ ) {
var countryStr = "/" + countryUris[i] + "/";
if(location.toString().toLowerCase().indexOf(countryStr) > -1) {
return true;
}
}
return false;
};
/* Main function to fire pixel based on matching the current URL to the URL Map */
var dxUpx = function() {
// the default case is not to check if wfivefivec is set.
var checkCookie = false;
var setCookies = [];
// If the URL contains one of the country URIs we need to check to see if
// the wfivefivec cookie exists, and only then fire the pixel
if(urlContainsCountryUri()) {
checkCookie = true;
}
if(appNexusMap.hasOwnProperty(location.href)) {
var imageSources = appNexusMap[location.href];
for(var i = 0; i < imageSources.length; i++) {
var img = document.createElement('img');
img.src = imageSources[i];
}
}
firePixel(checkCookie, setCookies);
};
// List of URIs / Dirs in the URL that reflect a URL where special conditions apply:
// I.e. only fire a pixel if dx cookie already exists.
var countryUris = [
"belgique",
"belgie",
"bulgaria",
"croatia",
"cz",
"denmark",
"estonia",
"finland",
"france",
"greece",
"hungary",
"italy",
"latvia",
"lithuania",
"netherlands",
"poland",
"portugal",
"romania",
"sk",
"slovenia",
"spain",
"sweden",
"uk"
];
var appNexusMap = {
'http://discover.sap.com/hana/es-es' : [
'https://secure.adnxs.com/seg?add=3599964&t=2'
],
'http://discover.sap.com/hana/en-za' : [
'https://secure.adnxs.com/seg?add=3599965&t=2',
'https://secure.adnxs.com/seg?add=3599966&t=2',
'https://secure.adnxs.com/seg?add=3599986&t=2'
],
'http://discover.sap.com/hana/en-me' : [
'https://secure.adnxs.com/seg?add=3599975&t=2',
'https://secure.adnxs.com/seg?add=3599983&t=2'
],
"https://www.sap.com/cmp/dg/crm-xj15-lob-fi-tr08/index.html" : [
"https://secure.adnxs.com/seg?add=3876815&t=2"
],
"https://go.sap.com/cmp/ppc/finance-simple/index.html" : [
"https://secure.adnxs.com/seg?add=3876818&t=2"
],
"https://www.sap.com/cmp/dg/crm-xj15-lob-fi-tr02/index.html" : [
"https://secure.adnxs.com/seg?add=3876819&t=2"
],
"https://www.sap.com/cmp/dg/crm-xe15-1fi-sip-st1/index.html" : [
"https://secure.adnxs.com/seg?add=3876820&t=2"
],
"https://go.sap.com/cmp/ppc/finance-planning/index.html" : [
"https://secure.adnxs.com/seg?add=3876821&t=2"
],
"https://go.sap.com/cmp/ppc/finance-grc/index.html" : [
"https://secure.adnxs.com/seg?add=3876822&t=2"
],
"https://go.sap.com/cmp/ppc/finance-treasury/index.html" : [
"https://secure.adnxs.com/seg?add=3876823&t=2"
],
"https://go.sap.com/cmp/ppc/finance-operations/index.html" : [
"https://secure.adnxs.com/seg?add=3876825&t=2"
],
"https://www.sap.com/cmp/dg/crm-xj15-lob-fi-tr08/index.html?campaigncode=CRM-XJ15-LOB-FI_TR09DX&source=onlinedisplay-EMEA-DataXu-IDC-Report_RunSimple" : [
"https://secure.adnxs.com/seg?add=3876827&t=2"
],
"https://go.sap.com/cmp/ppc/finance-simple/index.html?campaigncode=CRM-XJ15-LOB-FI_TR09DX&source=onlinedisplay-EMEA-DataXu-SimpleFinance_RunSimple" : [
"https://secure.adnxs.com/seg?add=3876828&t=2"
],
"https://www.sap.com/cmp/dg/crm-xj15-lob-fi-tr02/index.html?campaigncode=CRM-XJ15-LOB-FI_TR09DX&source=onlinedisplay-EMEA-DataXu-HBR-Report_RunSimple" : [
"https://secure.adnxs.com/seg?add=3876832&t=2"
],
"https://www.sap.com/cmp/dg/crm-xe15-1fi-sip-st1/index.html?campaigncode=CRM-XJ15-LOB-FI_TR09DX&source=onlinedisplay-EMEA-DataXu-SimplifiedPlanning_T1_RunSimple" : [
"https://secure.adnxs.com/seg?add=3876833&t=2"
],
"https://go.sap.com/cmp/ppc/finance-planning/index.html?campaigncode=CRM-XJ15-LOB-FI_TR09DX&source=onlinedisplay-EMEA-DataXu-SimplifiedPlanning_T2_RunSimple" : [
"https://secure.adnxs.com/seg?add=3876838&t=2"
],
"https://go.sap.com/cmp/dg/crm-xj15-lob-fi-sgrcach/index.html?campaigncode=CRM-XJ15-LOB-FI_TR09DX&source=onlinedisplay-EMEA-DataXu-SimpleGRC_T1_RunSimple" : [
"https://secure.adnxs.com/seg?add=3876840&t=2"
],
"https://go.sap.com/cmp/ppc/finance-grc/index.html?campaigncode=CRM-XJ15-LOB-FI_TR09DX&source=onlinedisplay-EMEA-DataXu-SimpleGRC_T2_RunSimple" : [
"https://secure.adnxs.com/seg?add=3876841&t=2"
],
"https://go.sap.com/cmp/ppc/finance-treasury/index.html?campaigncode=CRM-XJ15-LOB-FI_TR09DX&source=onlinedisplay-EMEA-DataXu-Treasury_RunSimple" : [
"https://secure.adnxs.com/seg?add=3876843&t=2"
],
"https://go.sap.com/cmp/ppc/finance-operations/index.html?campaigncode=CRM-XJ15-LOB-FI_TR09DX&source=onlinedisplay-EMEA-DataXu-FutureOfFinanceOps_RunSimple" : [
"https://secure.adnxs.com/seg?add=3876847&t=2"
],
"https://go.sap.com/cmp/ppc/finance-grc/typ.html" : [
"https://secure.adnxs.com/px?id=628259&t=2"
],
"https://go.sap.com/cmp/ppc/finance-operations/typ.html" : [
"https://secure.adnxs.com/px?id=628260&t=2"
],
"https://go.sap.com/cmp/ppc/finance-planning/typ.html" : [
"https://secure.adnxs.com/px?id=628261&t=2"
],
"https://go.sap.com/cmp/ppc/finance-simple/typ.html" : [
"https://secure.adnxs.com/px?id=628262&t=2"
],
"https://go.sap.com/cmp/ppc/finance-treasury/typ.html" : [
"https://secure.adnxs.com/px?id=628263&t=2"
],
"https://www.sap.com/cmp/dg/crm-xe15-1fi-sip-st1/typ.html" : [
"https://secure.adnxs.com/px?id=628264&t=2"
],
"https://www.sap.com/cmp/dg/crm-xj15-lob-fi-tr02/typ.html" : [
"https://secure.adnxs.com/px?id=628265&t=2"
],
"https://www.sap.com/cmp/dg/crm-xj15-lob-fi-tr08/typ.html" : [
"https://secure.adnxs.com/px?id=628266&t=2"
],
"http://discover.sap.com/hana/en-me/customer-reviews-stories.htmlCRM-XV15-1IT-SMOD_SOMP1" : [
"https://secure.adnxs.com/px?id=644291&t=2"
],
"http://discover.sap.com/hana/en-za/customer-reviews-stories.htmlCRM-ZA15-1IT-SMOD_SOMP1" : [
"https://secure.adnxs.com/px?id=644293&t=2"
],
"http://discover.sap.com/hana/en-za?source=onlinedisplay-KE-PaidDesktop_HITA-2015_Run_Simple_Platform-LP-KE_HITA&campaigncode=CRM-ZA15-1IT-SMOD_SOMM": [
"https://secure.adnxs.com/px?id=645468&t=2"
],
"http://discover.sap.com/hana/en-za?source=onlinedisplay-NG-PaidDesktop_HITA-2015_Run_Simple_Platform-LP-NG_HITA&campaigncode=CRM-ZA15-1IT-SMOD_SOMM": [
"https://secure.adnxs.com/px?id=645469&t=2"
],
"http://discover.sap.com/hana/en-me?source=onlinedisplay-SA-PaidDesktop_HITA-2015_Run_Simple_Platform-LP-SA_HITA&campaigncode=CRM-SA15-1IT-SMOD_SOMM": [
"https://secure.adnxs.com/px?id=645472&t=2"
],
"http://discover.sap.com/hana/en-me?source=onlinedisplay-XV-PaidDesktop_HITA-2015_Run_Simple_Platform-LP-XV_HITA&campaigncode=CRM-XV15-1IT-SMOD_SOMM": [
"https://secure.adnxs.com/px?id=645470&t=2"
],
"http://discover.sap.com/hana/en-za?source=onlinedisplay-ZA-PaidDesktop_HITA-2015_Run_Simple_Platform-LP-ZA_HITA&campaigncode=CRM-ZA15-1IT-SMOD_SOMM": [
"https://secure.adnxs.com/px?id=645471&t=2"
]
};
dxUpx();
}());