Reputation: 43
I am struggling to fire custom event (from custom code) along with my page load events. e.g. When my home page loads I want to trigger event 1 and if my dataelement meets certain condition it should trigger event2. So in my call in debugger I should see event1,event2.
But whats happening is my pageload rule is getting overwritten by custom event so I only get event2 in debugger.
Question is how do we append events to page load rule events.
Thanks
Upvotes: 1
Views: 949
Reputation: 421
The s.apl plugin should work fine when included as part of "do_plugins"but just for general clarification that plugin isn't necessarily needed. You could add a condition within the custom page editor of your rule that looks for the value of your Data Element and then appends the additional event. For example:
//Check for value of Data Element as page load rule executes
if(_satellite.getVar('My_Data_Element')) {
//Append additional event
s.events = s.events+',eventX';
}
If you try and evaluate this condition as part of your DE instead of using custom page code you will find issues with timing and execution.
Hope this helps.
Upvotes: 1
Reputation: 66
You can achieve it in easier way:
1) Create page load rule where you set condition criteria Data Element Value, and according to condition use proper event in events section. Even couple of rules will be combined into single image request to Adobe Analytics.
2) In custom code section you can add condition and add line:
s.events = s.events + ',eventN';
where N is your desired event number.
Upvotes: 0
Reputation: 43
I think I found the solution - we need to use s.apl plugin in scode to append events.
Good luck!
Upvotes: 0