How to Trigger workflow when an Element is viewed or any data viewed(view to Call)

"Dear Bubble community,

I hope this message finds you well. I am seeking guidance on how to trigger a workflow in Bubble when a user views specific data or elements, with the ultimate goal of calculating the number of views. Could you kindly share your expertise and suggest the best approach to achieve this functionality within the Bubble platform?

Thank you for your time and assistance.

What do you mean by “when a user views specific data or elements”?

How are you defining/deciding when a user has viewed something? (when they load a particular page? or when they click a particular link/button etc?)

I hope this message finds you well. I would like to discuss the concept of “when a user views specific data or elements” in a formal manner.

if i have page with 10 posts and user view only first and second post he didn’t scroll to last one to see all here i want to make workflow only to first and second post (only viewed by him )

You’d probably need to use the JavaScript Intersection Observer API for this…

I’m not sure if there are any plugins for this, so you might have to implement it yourself using the toolbox plugin…

Then you can trigger a workflow using the JavaScript to Bubble trigger action, whenever a particular element comes into the viewport.

I tried this with JS code but not work !

It should be fairly simple…

Why didn’t it work?

I search a lot for this but not work .