Hello, I need to base a load rule on a value returned by an Ajax call. This call is executed in an extension. It returns the value of a response header. This value is pushed into utag_data. That part works, after the page load I can see the value in the data layer. However, a load rule based on this value in the DL doesn't see it. Even though, as I understand it, the rule should be run twice. I thought that if it ran again at the end of the page load, it would see the value. Nope. I've gone over the order of operations, and tried moving the scope of the extension: Pre-loader, All Tags, the tag itself. I moved the extension to the top of the list, with the thought that this might give it some milliseconds more time to complete. No joy. I tried setting the Ajax call to sync, but this is a bust. It does not, near as I can make out, affect the page load at all. It merely makes the send() function wait until the response is complete before returning it. Which is probably worse, from a timing aspect. A snippet that reproduces the request: xhr.onreadystatechange = function () {
if (xhr.readyState === 2) {
ans = xhr.getResponseHeader(hdr);
if (ans !== '' && ans !== null && ans !== "undefined") {
window.ans = ans;
that._datalayer[that._dataname] = ans;
}
}
}; As I indicated, the returned value does land where I expect it to be. The $64,000,000 question: how can I use this value in a load rule? Thanks.
... View more