Title: Addition to source code
Last modified: November 22, 2016

---

# Addition to source code

 *  [potnii](https://wordpress.org/support/users/potnii/)
 * (@potnii)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/addition-to-source-code/)
 * In gapp_get_post_pageviews() function change $permalink from
    `$permalink = '/'.((
   $ID != 1) ? basename(get_permalink($ID)) : null);` to `$permalink = '/' . (($
   ID != 1) ? basename(get_permalink($ID)) . '/' : null);` and from `$permalink 
   = '/' . basename(get_permalink());` to `$permalink = '/' . basename(get_permalink()).'/';`
 * When plugin makes call to google analytics api he uses ‘ga:pagePath’ filter. 
   So if we have 2 articles where permalink of 1st is ‘website.com/permalink-part’
   and 2nd is ‘website.com/permalink-part-two’, and we will ask google analytics
   about statistics on 1st article – **we will get summary statistics of 1st and
   2nd**, because permalink of 2nd match to regular expression that takes information
   from google analytics on 1st.
    -  This topic was modified 9 years, 6 months ago by [potnii](https://wordpress.org/support/users/potnii/).

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [maximevalette](https://wordpress.org/support/users/maximevalette/)
 * (@maximevalette)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/addition-to-source-code/#post-8473695)
 * Thanks for your submission.
 * The issue with that is that it won’t take the possible pages into account, that’s
   why I didn’t add the trailing slash in the first place. What would you suggest?
 *  Thread Starter [potnii](https://wordpress.org/support/users/potnii/)
 * (@potnii)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/addition-to-source-code/#post-8479757)
 * What do you mean by
 * > it won’t take the possible pages into account
 * ?
 * I thought that every time when you view posts in admin panel it automatically
   download statistics by post permalink.
    Or there is issue in google analytics?(
   I just don’t have access to google analytics to test problem from both sides).
 *  Plugin Author [maximevalette](https://wordpress.org/support/users/maximevalette/)
 * (@maximevalette)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/addition-to-source-code/#post-8482965)
 * For example, posts with multiple pages have `/page-1` `/page-2` etc. so by removing
   the trailing slash it will take everything into account.
 *  Thread Starter [potnii](https://wordpress.org/support/users/potnii/)
 * (@potnii)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/addition-to-source-code/#post-8488006)
 * Ok. But what is the difference in statistics between post with multiple pages
   and single page? It seems like statistics of post with multiple pages is sum 
   of statistics of it’s pages. For example statistics of such post will be ‘post/
   page-1’ + ‘post/page-2’ etc.
    And in admin panel we don’t see statistics of post’s
   pages. So I think there isn’t need in statistics of post pages. Or there is?
 *  Plugin Author [maximevalette](https://wordpress.org/support/users/maximevalette/)
 * (@maximevalette)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/addition-to-source-code/#post-8492256)
 * > It seems like statistics of post with multiple pages is sum of statistics of
   > it’s pages. For example statistics of such post will be ‘post/page-1’ + ‘post/
   > page-2’ etc.
 * Exactly, that’s why I can’t add the trailing slash, it wouldn’t work in every
   situation. Maybe the best way would be to add a setting.
 *  Thread Starter [potnii](https://wordpress.org/support/users/potnii/)
 * (@potnii)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/addition-to-source-code/#post-8502487)
 * I think there is no need to count post views this way. If I read first page of
   post and didn’t read second it doesn’t mean that I didn’t view post.
    For example
   youtube counts video views if you watch only 3 seconds of video. And also if 
   to think that your way of post counting is right it means that we have to count
   post view on single page posts only if user scrolled to the bottom of page. I
   am sure it doesn’t happen this way. Is there any other controversial situation
   with post counting? And in the end you can add setting to make every user decide
   for himself what is the right way.
 *  Plugin Author [maximevalette](https://wordpress.org/support/users/maximevalette/)
 * (@maximevalette)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/addition-to-source-code/#post-8506475)
 * Added the setting in the new version 🙂

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Addition to source code’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/google-analytics-post-pageviews.svg)
 * [Google Analytics Post Pageviews](https://wordpress.org/plugins/google-analytics-post-pageviews/)
 * [Support Threads](https://wordpress.org/support/plugin/google-analytics-post-pageviews/)
 * [Active Topics](https://wordpress.org/support/plugin/google-analytics-post-pageviews/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/google-analytics-post-pageviews/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/google-analytics-post-pageviews/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [maximevalette](https://wordpress.org/support/users/maximevalette/)
 * Last activity: [9 years, 5 months ago](https://wordpress.org/support/topic/addition-to-source-code/#post-8506475)
 * Status: not a support question