Google Analytics Graphs to your Dashboard in Python Web Frameworks

E-commerce solution providers like OpenCart, Magento Provide extensions to see Google analytics data in their own dashboards as graphs. whereas there are no such plugins available in Python. In this tutorial, we will learn how to display google graphs on your website.

Open Google Developers Console, Create a new project or open existing project. enable google analytics API. create a service account and generate a JSON Key File. Use the below function to generate an access token for analytics in read-only mode.

Python:

you need to pass Google UserID and Google Acess Token to template.

Javascript:

HTML

With above code you will generate the user session graph which can switch between week view and month view and also change type of Graph

Other configuration options like dimensions,metrics and filters are available at Google Metrics Explorer.

The article was originally published at MicroPyramid blog

Python, Django, Android and IOS, reactjs, react-native, AWS, Salesforce consulting & development company