Fire Launch Rule Upon Scroll Depth And Time Spent

The inimitable Simo Ahava recently posted an article named Fire GTM Tag Upon Scroll Depth And Time Spent, in which he explains both why and how to fire tracking after visitors have either lingered on or scrolled to a certain depth on pages.

With his permission, I’ll show you how to do the same with Launch, by Adobe.


The idea is to measure how the content on your web site is being consumed, read. A lot of people use metrics like “Time on Site” or “Time on Page” or “Time Spent” or whatever your Solutions calls it to figure this out, or rather to approximate it.

The huge problem with that is that you can’t actually measure whether a visitor is really looking at the page while it is open. For all we know, they could have left the room!

If you’re a media site, or if your site has content that is considered important (banks have a lot of that), then you need to know whether your content people write the right stuff.

And while the approximation helps, there are better ways, some of which both Simo and I have written about.

This time, Simo suggests combining time and scrolling.

If a visitor scrolls a certain way, and if they linger for more than a certain time, do something.

The novelty is to combine those two conditions in a single Rule, to use two different parameters and trigger one action.

You might remember that I did something similar with DTM some time ago (see Delayed Page Load Tracking with DTM), but now we have Launch. And it’s easy-peasy with Launch.


Just like GTM, Launch treats multiple Events in a Rule as “OR”, meaning any of the two Events would trigger the Rule.

Simo gets around that by making sure the triggers each take into account whether the other has already fired or not. We can do the same thing in a bunch of different ways in Launch.

One way would be to do it like in the “delayed page load tracking” article mentioned above, using a “Custom Event” Event and a single Rule. A variation of that could be to use a “Custom Code” Event.

Another way would use three Rules. The first would trigger on time, the second on scroll depth, and both would call the third, actual, Rule, which would have a condition “both have fired”, so to speak.

I don’t particularly like any of those approaches. There would be a lot of Javascript code, hidden away, yes, but it wouldn’t be clear to a casual observer what the Rule/Rules was/were doing.

The proper way of doing this in Launch, you ask?

Well, obviously, we build an Extension!

The Extension will provide a single Event Type, which encapsulates the whole thing, and which has four configurable settings:

  • Threshold of time spent on page,
  • threshold for scroll depth in %,
  • a toggle which can be set to “fire just once per page” or “fire every time this happens”, and
  • a delay time for attaching the scroll listener, in case the page builds dynamically.

In order to complete the Make an Extension mini series, I’ll write about how to test an Extension in the sandbox (there have been changes), how to test it on the integration environment, and how to publish it, when it is done. done

For now, all you need to do is find my Extension in the Catalogue, add it to your Property, then use it in your Rule.

Ah, so simple!

If you want, you can see the sources on github, of course.


It was great fun writing this little Extension!

The process has changed since I wrote about making an Extension, which means I got to write about the changes. I was also able to write the final article, about publishing your Extensions.

So thank you, Simo, for pushing me to dig deeper into this topic!

The whole thing is possible with DTM, too, but given that we now have an official end of life announcement, I shall ignore DTM completely from now on.

One flaw in my Extension is that it is imho overly specific. I may or may not work on an alternative Extension that provides all sorts of “engagement”-related Events

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.