trigger pageload or event rule from script

Avatar

Avatar

davidh97534450

Avatar

davidh97534450

davidh97534450

02-05-2018

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!

View Entire Topic

Avatar

Avatar

joshd7227840

MVP

Avatar

joshd7227840

MVP

joshd7227840
MVP

07-05-2018

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.