That is a really good article explaining the use case for this plugin. Here is an article directly from Adobe's help center with the code and another explanation:
Don't forget to use the getPreviousValue plugin as well. Without it the getPercentPageViewed plugin in pretty useless:
NOTE: Don't forget the utility plugins like s.split as shown in the getPreviousValue page.
The minified plugin code would go into the Plugins and Modules Extension and can just be added to the bottom of the list.
The code that calls the functions would go in the other Extension within the doPlugins function.
There are a couple different ways to implement this, but all the information needed is given within the examples.
Hope this helps!