getPercentPageViewed plug in not working as expected | Community
Skip to main content
May 5, 2024
Question

getPercentPageViewed plug in not working as expected

  • May 5, 2024
  • 1 reply
  • 1291 views

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!


This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

bjoern__koth
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
May 5, 2024

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

Cheers from Switzerland!
JackieTuAuthor
May 5, 2024

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.

bjoern__koth
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
May 6, 2024

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

Cheers from Switzerland!