New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a configurable offset to Content Tracking with JavaScript #17601
Comments
Hi @JE4GLE, thanks for taking the time to create this issue! From what I know, |
I think is was just a loading issue with some CSS, which got loaded after the initialization of the tracking code. This way, the page shifted a bit and moved the elements out of sight. |
@JE4GLE so they were visible on page load for a brief moment, then the css moved or hid them, and the problem is that they were tracked before the css moved them, is this understanding correct? |
Yes, I have one stylesheet for the whole page loaded at the end of the page (but before the tracking script) |
Hi @JE4GLE, I tried reproducing this (w/ the stylesheet at the end of the page before the tracking), and was still not able to reproduce. Would you be willing to share the website that this is occurring on over email? If so email dizzy@innocraft.com. If you could also tell me what browser you're using that would help as well. |
As discussed via email, this is likely a race condition with the stylesheet being loaded after the JS is executed. I'll close this for now, but feel free to reopen it. |
Summary
When using the content tracking feature, the JavaScript tracker often detects content, which is not visible on the screen. This can be tested by creating a div with 100vw/vh width and height. Then adding another piece of content below. In my case, the second content is still tracked, without scrolling. So adding an offset in pixels, which an element has to be visible would be solving this issue.
This can either be defined globally on initialization of the tracking api:
_paq.push(['trackVisibleContentImpressions', true, 750, 50]); // 50px offset
or per element using a tag:
<div data-content-offset="50"></div>
Environment
The text was updated successfully, but these errors were encountered: