by kra3

kra3 /py-ga-mob

PYGA: Python Google Analytics (ga.js) - Data Collection API

129 Stars 37 Forks Last release: over 1 year ago (v2.6.1) Other 149 Commits 12 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:


PYGA: Python Google Analytics - Data Collection API

.. image:: :alt: Build Status :target: .. image:: :target: .. image:: :target:

pyga is an implementation of Google Analytics (ga.js) in Python; so that it can be used at server side. This project only helps you with Data Collection part of Google Analytics. ie., You can consider this as a replacement for ga.js at client side.

Google Provides Android SDK,iOS SDK + Flash SDK. And left everybody else with a single page documentation about GIF request parameters. Also with a basic sample of server side implementation in quite a few languages (perl, php, jsp).

PS: Google moved away from ga.js to analytics.js; a new operating standard for Google Analytics named "universal analytics". Soon ga.js will be deprecated. I'm planning to have a pyga equivalent to the new standard. Read more here at

  • PyPi Package Page:
  • Main Repository:
  • Documentation:

Use Cases

  1. You want to track data from server side
  2. You're developing a mobile site and have to support devices w/o JS support

Supported Features

  • Page View
  • E-Commerce
  • Social Interaction
  • Custom Variables
  • Events
  • Campaigns

not yet

  • Ad-Words
  • Search Engine

To know more about mobile-tracking see:



 from pyga.requests import Tracker, Page, Session, Visitor

tracker = Tracker('MO-XXXXX-X', '') visitor = Visitor() visitor.ip_address = '' session = Session() page = Page('/path') tracker.track_pageview(page, session, visitor)

PHP version 

Thanks to:

Expicient Inc 

And for you fans out there, we even have

mountain bikes named pyga 
_ ;)

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.