I was wondering if someone knew of the syntax that would allow me to fire a rule from within the custom code section of a rule.
thanks
Solved! Go to Solution.
Views
Replies
Total Likes
How about a classic direct _satellite.track call and a rule listening to this direct call event?
_satellite.track('contact_submit', { name: 'John Doe' });
https://experienceleague.adobe.com/en/docs/experience-platform/tags/client-side/satellite-object
While I don't know of code to directly call a rule.... if you have a rule set up to trigger based on a custom JS event, you could call the event from within custom code that would then cause the other rule to trigger, essentially resulting in the same final result....
So for instance, let's say I set up Rule A to trigger based on a custom code listener:
window.addEventListener('myCustomEvent', function (e) {
trigger();
}, false);
Now, in Rule B, I want to run some logic to trigger Rule A.
I'm going to assume that the event "myCustomEvent" isn't declared yet, so I will both declare and dispatch the event inside of Rule B
var myCustomEvent = new Event("myCustomEvent");
window.dispatchEvent(myCustomEvent);
As soon as I call the window.dispatchEvent for myCustomEvent, Rule A will trigger.
Views
Replies
Total Likes
One more thing, for the record, I've never had a lot of luck using the "Custom Event" trigger in Launch... but I've had a lot more success with creating my own listeners, so I've been doing this for years...
So following the old adage: "stick with what works"
I mention this, cause I figured that will be the follow up comments as to why I didn't just use the Custom Event event type.
Views
Replies
Total Likes
Thanks Jennifer
This solution is great in another case for me appreciate the response!
How about a classic direct _satellite.track call and a rule listening to this direct call event?
_satellite.track('contact_submit', { name: 'John Doe' });
https://experienceleague.adobe.com/en/docs/experience-platform/tags/client-side/satellite-object
Thanks Bjoern
I sis happen to have a DCR on that rule so this will work appreciate the response.
Views
Replies
Total Likes