Is there a way to track how many times an image is viewed on a screen?

Is there a way to track how many times an image is viewed on a screen? The image must be within the actual screen window and visible to the user for it to count as a view. I need stats like this for advertisers to see how many times their image was physically seen by a person using the app. Is this possible?

Think the most feasible way is to use a custom component for this.

You feed your image URL as a variable, and tie another “counter” variable to it.

Tell Glide to display the image, and try to tell it to load only when the user scrolls to that part of the screen. Every time the component is loaded, increment the counter by 1.

I’m not sure if it will work though, those components can be pre-loaded when you enter the screen.

Hey, thanks for the reply. I was hoping to use normal collections with images. And it increments a counter each time the images enters the viewport/visible screen. I’ll try to test your method.

Do you know how web embeds work. I managed to create a trigger within a web embed that runs when the page is opened. It runs through vercel and increments a counter in my supabase (adds a new row for any new images and increments accurately no matter how many users are viewing images simultaneously) It would have worked so well but the problem is that the web embed seems to only trigger if the images are inside the embed, which is useless. Do you know how to work with embeds and have any suggestions?

Have you looked into one of the app analytics integrations? PostHog, Google Analytics via Google Tag Manager or Mixpanel come to mind.