I'm trying to write a rule that conditions on the content of a javascript alert box. That is, I'm trying to fire a conversion script if the alert says "submission successful" vs "some error message". Can I access the string shown in the alert box so I can use it ie if alert message == "submission successful" fire the tracking script?
You could override alert
so that you could track what is being alerted. For example:
window.alert = (function() {
var existingAlert = window.alert;
return function(message) {
console.log(message); // do your tracking here
existingAlert(message);
};
})();
You would need to be able to run this code before other code called window.alert
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.