Hi Natpatch
The Order of Operations does explain why this isn't working for you. However, there are still ways to achieve what you wish.
One way is to use an extension scoped to Pre-Loader. As the name suggests, these extensions run before load rules are evaluated. Currently, Tealium iQ only supports JavaScript based Pre-Loader extensions. This is due to be improved soon.
However, you can still recycle the lookup extension you already wrote, if you wish.
What you can do is to find the code that has been published for your lookup extension. It will be in utag.js if it is an All Tags scoped extension. Otherwise, it may be in the utag specific js file for the tag the extension is scoped to, or in the main utag.js (depends on how your bundling is set up). Anyway, you should be able to find the code by using e.g. Chrome developer tools to search all source code for one of the strings your lookup table is using.
Here's what the code will look like (mine is generic)
, function(a, b, c, d, e, f, g) {
d = b['input_source'];
if (typeof d == 'undefined')
return;
c = [{
'Match1': 'M1'
},
'Match2': 'M2'
}, {
'Match 3': 'M3'
}];
var m = false;
for (e = 0; e < c.length; e++) {
for (f in c[e]) {
if (d == f) {
b['output_source'] = c[e][f];
m = true
}
;
}
;if (m)
break
}
;if (!m)
b['output_source'] = 'd';
}
Once you've found the code, you will need to modify it slightly. Here's my transformed code
(function() {
window.utag_data = window.utag_data || {};
var b = window.utag_data;
var d = b['input_source'];
if (typeof d == 'undefined')
return;
var c = [{
'Match1': 'M1'
}, {
'Match2': 'M2'
}, {
'Match 3': 'M3'
}];
var m = false;
for (var e = 0; e < c.length; e++) {
for (var f in c[e]) {
if (d == f) {
b['output_source'] = c[e][f];
m = true;
}
}
if (m)
break;
}
if (!m)
b['output_source'] = 'd';
})();
That code should now run in a PreLoader extension and do what you wish. You can leave your load rule in place.
Mark