Can I check if lets say an image in index.php is seen by user? I do not only want to know if page is visited, but also user scrolled down the page and this image is displayed or not.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s not an easy thing to do.
You need to check is if user scrolled down to the position of element, and then, if true, make an AJAX call to PHP that will save this information into the database.
Most accurate way to do this is by using jQuery .scrollTop to see how far user scrolled down and compare it with .offset.
Keep in mind though that it’s not 100% accurate. It should be good enough for most of layouts and most of images, however small pictures placed in layouts that use lot of paddings will most likely return incorrect results (either indicating that image was viewed before it actually was, or after, assuming you scroll down to see it).
If I were you – I’d try to avoid this functionality. 😉 It’s just too prone to errors that you can’t really do anything about.