JSFiddle - React, Tailwind, and code Playground
by swoogie
JavaScript
function (input) {
var dataArItem = {
'pageType': 'confirmation',
'Product IDs': _.flatten(input.productIDs),
'Prices': _.flatten(input.prices),
'Quantities': _.flatten(input.qtys),
'Transaction ID': _.isSet(input.tID) ? input.tID : undefined
},
dataConf = {
'Transaction ID': ['t', 0],
'Product IDs': ['i', 1],
'Prices': ['p', 1],
'Quantities': ['q', 1]
},
callsConfig = [
input.partnerID,
input.pool,
input.loc,
(input.protocol.substr(​0, 1) + '000').substr(0, 3),
[_.flatten(input.widgetIDs)],
dataConf
];
window.CRITEO_CONF = [[dataArItem], callsConfig];
}({
productIDs: '##CRITEO_PRODUCT_IDS##',
partnerID: '##CRITEO_PARTNER_ID##',
pool: '##CRITEO_POOL##',
loc: '##CRITEO_LOCATION##',
protocol: '##CRITEO_CALL_PROTOCOL##',
widgetIDs: '##CRITEO_WIDGET_IDS##',
tID: '##CRITEO_TRANSACTION_ID##',
prices: '##CRITEO_PRICES##',
qtys: '##CRITEO_QUANTITIES##'
}));