shenk shenk - 6 months ago 13
Javascript Question

Google Analytics Page/Content Tracking

When using Google Analytics with say Django. Is the tracking code on my base template enough (assuming the correct context processors and such are in place)? Will GA be able to track when people click on links to other pages? Will GA be able to track when people view pdfs with links on the page?

Do I need to use the gaq.push() js function? And if not when is it necessary to do so?

Answer

I didnot want to answer, because it is just too broad and can be googled easily. but let me give my two cents.

In Django, if you correctly build base.html and inherit it correctly in all pages that need base.html, the tracking code which is in base.html should be available in all templates that inherited base.html.

as for PDF, you may want to create events in Google Analytics, since the clicks on PDFs won't be normally tracked by standard tracking code. here is how you create events in GA.

gaq.push() event is now deprecated and you should not use it. Instead you should use the send event with ga command queue. here is how you use it.

Comments