Visitor : 76

Read Comments

Tracking Django Website Page hits using Google Analytics

Django Hosting


Tracking number of hits for a website is the perquisite for understanding the target audience and for improving the content of the web page. Even though there are multiple solutions available in the market , matching the functionalities of Google Analytics might be difficult. This article explains the various option available for tracking websites built on Django framework.

Google Analytics 

Google Analytics is the most efficient and simpler option for tracking the hits on your website. A simple registration process on the google analytics site should kick start the process. Once the site is registered follow the link https://support.google.com/analytics/answer/1008080?hl=en to obtain the script for tracking the pages.

 

 

Copy the script and add it to the layout or the base page of the django template. This will take care of all the tracking requirements.

 

Note :

There are few API available for django - Google analytics. Please note that those API's are to be used only in case the requirement is to tracks the count from the server side instead of using JS provided by google. These API's can be used to fetch data from google analytics site for analysis.

Eg : https://pypi.org/project/django-google-analytics-app/ 

if the requirement is to track the number of hits the easiest and effective solution is to include the google analytics script to <head> tag of the html page.



Add Comments