Expand my Community achievements bar.

Help shape the future of AI assistance by participating in this quick card sorting activity. Your input will help create a more effective system that better serves your needs and those of your colleagues.
SOLVED

trigger pageload or event rule from script

Avatar

Level 2

Is it possible trigger a pageload or event rule from script?

I am aware of the _satellite.track('my-direct-call') syntax, and would like to know if there as an equivalent for pageload/event rules.

Thanks!

1 Accepted Solution

Avatar

Correct answer by
Level 9

It is possible to get DTM to re-evaluate  page load and event based rules after page load, but it involves some internal _satellite method calls passing some dummy/rebuilt objects, it is not supported by Adobe for public use, and in practice it won't actually work for you 9/10 times.

Given the current limitations / state of DTM, the best way of doing it is along the lines of what Jantzen.Belliston​ already mentioned.

But in general, one of the benefits of migrating to Launch is that it is a lot more friendly to situations such as yours.

View solution in original post

6 Replies

Avatar

Level 10

For pageload, here is a thread where some information was discussed about _satellite.pagebottom()

satllite.pagebottom and satellite.track

As for an event rule, they are typically used in the exact opposite way. An event rule watches for something to happen on the page (including your own custom event), then fires. If you want to trigger an event based rule based on some custom code, I'd suggest firing your own event or using direct call rules. Here is a article that talks about using custom events in DTM

Use custom events in Adobe DTM

Avatar

Level 2

Hi Jantzen,

One scenario I am trying to work on is:

- A user loads a page, and some of the page load rules don't trigger (IE: due to a custom condition not being met)

- the user interacts with the page and some event rules don't trigger due to a custom condition not being met

- then user changes an option on the page that means the custom condition on previous checks would be met/true.

Is there away to re-call the rules that failed the first pass without having to reload/refresh the entire page?

I was hoping to trigger for a call something like in the handler for the changing of the option:

-----------------------------------------

_satellite.pageTrack('my-page-load-rule-name');//and the same/equivalent for an "event" rule too

----------------------------------------

Avatar

Level 10

I'm not aware of a way to specifically call rules, aside from Direct Call Rules.

joshd7227840 - May have some other ideas. He's done a lot of custom work with DTM and often comes up with great solutions for unique scenarios like this.

Avatar

Correct answer by
Level 9

It is possible to get DTM to re-evaluate  page load and event based rules after page load, but it involves some internal _satellite method calls passing some dummy/rebuilt objects, it is not supported by Adobe for public use, and in practice it won't actually work for you 9/10 times.

Given the current limitations / state of DTM, the best way of doing it is along the lines of what Jantzen.Belliston​ already mentioned.

But in general, one of the benefits of migrating to Launch is that it is a lot more friendly to situations such as yours.

Avatar

Level 2

Hi Jantzen and Josh,

Thanks for taking the time to help on this.

What you have told me confirms what I was suspecting.

I was hoping to avoid a full page refresh for my solution, but looks like I'll have to do that to retrigger all I need.

Thanks again

Avatar

Level 9

Okay well to be clear..  depending on what the full details/requirements for the tags vs. the site are, you may not have to do a full page refresh to make the tracking trigger. There are alternatives to "refresh the page" and "artificially re-invoke/eval PLRs"!.

For example, Let's say you have a page load rule (PLR) with a condition to output if path is /somepage.html AND if a selected dropdown option value is "bar".  And let's say it is possible for the page to be loaded with "bar" pre-selected, but it's also possible for the dropdown to start with a different option selected.  But you only want the tag to be output if "bar" is selected, be it initial page load or after page load.

You can create your PLR as you have already done. Then, you can create a separate event based rule (EBR) similar to your page load rule conditions, where you set a condition to ensure you are still on the same page /somepage.html, and have the event type be forms > change. The biggest downside to this is having to maintain two separate rules for one tag.

Alternatively, you can leverage an EBR of dataelementchanged type to have a single rule to handle both page load and after page load scenarios, but it's a bit clunkier and potentially not as accurate (depending on site function vs. poll rates). I wouldn't really consider it unless I'm doing a lot of tagging/rules and maintaining duplicate rules for a ton of tags starts to outweigh the the dataelementchanged approach.