Hello,
I have implemented the getPercentPageViewed plugin, but I am not getting back any results. In installed the plugin by creating a rule and published it. I can see the function being added when I load the page.
In the custom code tracker I added code to call the function: s.getPercentPageViewed() and then I tried to get data from the values set by the plugin:
if (s._ppvPreviousPage) {
console.log('_ppvPreviousPage: ', s._ppvPreviousPage)
console.log("initialPercent=" + s._ppvInitialPercentViewed + " | highestPercent=" + s._ppvHighestPercentViewed + " | finalPercent=" + s._ppvFinalPercentViewed + " | foldsAvailable=" + s._ppvFoldsAvailable + " | foldsSeen=" + s._ppvFoldsSeen)
}
I never see any meaningful data. I also never see any of the cookies being set by the plugin, even though I do see some other analytics cookie values being set.
Any feedback would be appreciated! Thank you!
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
HI @JackieTu ,
I think you are under the wrong impression that the plugin creates additional properties on the "s" object.
Check out the documentation here, it states that these values are created on the "window" object.
Maybe try this instead
if (window._ppvPreviousPage) {
console.log('_ppvPreviousPage: ', window._ppvPreviousPage)
console.log("initialPercent=" + window._ppvInitialPercentViewed + " | highestPercent=" + window._ppvHighestPercentViewed + " | finalPercent=" + window._ppvFinalPercentViewed + " | foldsAvailable=" + window._ppvFoldsAvailable + " | foldsSeen=" + window._ppvFoldsSeen)
}
Cheers
Björn
Views
Replies
Total Likes
Thank you for the quick reply. I saw that in the documentation as well, but I don't see any of those being set on the window. I only see the function and the variables being set on the s object. I even tried calling window.getPercentPageViewed and it says the function is not defined, I can only call it by s.getPercentPageViewed.
Hi @JackieTu
the solution is that you will have to call s.getPercentPageViewed(); first to initialize the values.
Calling this function returns nothing; instead, it sets the following variables:
...
s.getPercentPageViewed();
console.log("initialPercent=" + s._ppvInitialPercentViewed + " | highestPercent=" + s._ppvHighestPercentViewed + " | finalPercent=" + s._ppvFinalPercentViewed + " | foldsAvailable=" + s._ppvFoldsAvailable + " | foldsSeen=" + s._ppvFoldsSeen);
This is how it looks for me
Let me know if that works
Björn
Views
Replies
Total Likes
I found the issue, there was actually a setting in my browser blocking the cookies being set so the plugin could not work correctly. Everything is working as expected now. Thank you for your help!
Glad you figured it out!
Views
Replies
Total Likes