def setUp(self): self._buffer = HTTPLog.StringIO() HTTPLog.consume(self._buffer) # Capture HTTP output in readible fashion Tracker.HTTPPost.debug() # Enabled debugging from urllib2 # Create the tracker self.tracker = Tracker.create('UA-XXXXX-Y', use_post = True)
def setUp(self): self._buffer = HTTPLog.StringIO() HTTPLog.consume( self._buffer) # Capture HTTP output in readible fashion Tracker.HTTPPost.debug() # Enabled debugging from urllib2 # Create the tracker self.tracker = Tracker.create('UA-XXXXX-Y', use_post=True)
############################################################################### # Test and example kit for Universal Analytics for Python # Copyright (c) 2013, Analytics Pros # # This project is free software, distributed under the BSD license. # Analytics Pros offers consulting and integration services if your firm needs # assistance in strategy, implementation, or auditing existing work. ############################################################################### from UniversalAnalytics import Tracker DEBUG = True if DEBUG: # these are optional... from UniversalAnalytics import HTTPLog HTTPLog.consume() # Filters urllib2's standard debugging for readability Tracker.HTTPPost.debug() # Enables debugging in urllib2 # Create the tracker tracker = Tracker.create('UA-XXXXX-Y', name = 'mytracker', use_post = True) # Apply campaign settings tracker.set('campaignName', 'testing') tracker.set('campaignMedium', 'testing') tracker['campaignSource'] = 'test-source' # Send a pageview tracker.send('pageview', '/test') # Send an event