1

I have on my website a lot JS, e.g.:

<a href="#" class="slideshow-button clicked">Slideshow</a>

<a href="#" class="fullscreen-button clicked">Full Screen</a>

When user click on that this not affect "page per session" ? if I edit the HTML and add in a href e.g. example.com/something will it then affect "page per session"?

1

If you want to track users doing actions on your site, without a pageload, Google Analytics provides events. You can send arbitrary events to Google Analytics and it will track them. I once had a site that users would open and stay on one page for extended periods of time, and had an event polling every 2 minutes checking in that the user still had the page open.

| improve this answer | |
0

Google Analytics counts page views whenever a page with the tracking snippet are loaded. Clicking links on those pages that trigger JavaScript but do not load another page would not increase the Google Analytics page view count.

You are correct that using full URLs (without a # in them) could help. When your hrefs are full URLs to other pages with the tracking snippet, GA would see additional page views and increase the "pages per session" metric.

Alternatively, you could have your JavaScript send extra page views programatically. Google has a guide for single page applications that shows how to send virtual page views with code like:

ga('set', 'page', '/slideshow');
ga('send', 'pageview');
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.