Triggers "On Sign In" or "On Player Open"

Historically there have been some gaps involving the ability to fire triggers when a new user signs in or when the player is closed and reopened, since these events do not cause an “App Started” or “Step Enter” trigger.

I found a really simple solution with a custom widget based on the javascript rendering that can solve both of these problems in a very simple way.

The widget just looks like this (code snippet below)

With no visible content. If you place this on the base layout of your app you will now have the ability to trigger events when an app is rendered, which happens whenever someone signs in or when someone re-opens the player.

document.addEventListener("DOMContentLoaded", function () {
  fireEvent("Page Rendered");
});

Happy Tulip-ing!

3 Likes

More fun with DOM events… I haven’t tested this on android or iOS, but worth documenting if someone might need to deal with apps being minimized.

image

document.addEventListener("visibilitychange", function () {
  if (document.visibilityState === "visible") {
    fireEvent("App Un-Minimized");
  } else {
    fireEvent("App Minimized");
  }
});
4 Likes

Thanks for this Daniel! I have several use cases where a trigger on operator login will be extremely useful :grin:

1 Like

Great input. Never thought about that.

Will a step change be considered as the same page rendered, or will this also trigger the event?

1 Like