ckorski
12/22/2015 - 12:44 AM

events in page load rule http://webanalyticsfordevelopers.com/2015/09/15/dtm-find-the-rule-that-does/

// events in PLRs
for(var i = 0, max = _satellite.pageLoadRules.length; i < max; i++) { 
	var plr = _satellite.pageLoadRules[i]; 
	console.log("PLR: " + plr.name);
	for(var j = 0, max2 = plr.trigger.length; j < max2; j++) { 
		var tr = plr.trigger[j]; 
		if (tr.command == "addEvent") { 
			for (k = 0; k < tr.arguments.length; k++) { 
				console.log("  " + tr.arguments[k]); 
			} 
		} 
	}
}

// http://webanalyticsfordevelopers.com/2015/09/15/dtm-find-the-rule-that-does/
_satellite.rules.forEach(function(obj,index){
    var rulename = obj.name;
    if (obj.trigger) {
        obj.trigger.forEach(function(obj,index){
            if (obj.command == "trackLink" || obj.command == "trackPageView") {
                if (obj.arguments) {
                    obj.arguments.forEach(function(obj,index){
                        if (obj.addEvent) {
                            var output = rulename + ": ";
                            obj.addEvent.forEach(function(obj,index){
                                output += obj + ", ";
                            });
                            _satellite.notify(output, 3);
                        }
                        if (obj.setVars) {
                            for (var key in obj.setVars) {
                                _satellite.notify(rulename + ": " + key + " > " + obj.setVars[key]);
                            }
                        }
                    });
                }
            }
        });
    }
});