2

I have a few pages on a website where some sections use a JavaScript slider to display content and I was wondering if it's possible for Google Analytics to track those sections?

For now when a section is clicked on the URL changes to http://example.com/example.html#/example-section

I'm trying to figure out a way I can track those sections with Analytics as well as have Google properly crawl them, any suggestions?

1

1 Answer 1

2

Since the sections are revealed by JavaScript, you can use the pageTracker in Google Analytics to manually log a hit. For example:

// Log this usage in Google Analytics.
pageTracker._trackPageview('/slider-page/part1');

Add that to the JavaScript which triggers the change in the page. The parameter given to the trackPageview method will be used as the path of the page in the content lists in Google Analytics, so be sure to use a different one for each section.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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