API Reference¶
- class manhattan.visitor.Visitor(id, log, site_id='', buffer_writes=True)[source]¶
A handle to perform operations on the given visitor session.
- AVERAGE = 'A'¶
- CURRENCY = 'C'¶
- NUMERIC = 'N'¶
- PER = 'I'¶
- PERCENTAGE = 'P'¶
- RATE = 'R'¶
- SUM = 'S'¶
- goal(name, value=None, value_type=None, value_format=None)[source]¶
Log a goal hit for this visitor.
Parameters: - name (str) – Name of the goal.
- value (int or float) – Value of this goal.
- value_type (RATE, AVERAGE or SUM) – Type of goal value aggregation to perform.
- value_format (NUMERIC, CURRENCY, or PERCENTAGE) – Display format for this goal value.
- page(request)[source]¶
Log a page view for this visitor.
Parameters: request (webob.Request instance) – A request object corresponding to the page to log.
- split(test_name, populations=None)[source]¶
Perform a split test for this visitor. The resulting population is calculated deterministically based on the test name and the visitor id, so the same visitor id and the same test name will always be assigned to the same population.
Parameters: - test_name (str) – Name of the test.
- populations –
Population specified. Can be any of the following:
None – 50/50 split performed between True or False. list – Select evenly between entries in the list. dict – A weighted split between keys in the dict. The weight of each population is specified by the value, as a float.
Returns: The population selected for the visitor.
- class manhattan.middleware.ManhattanMiddleware(app, log, secret, cookie_name='manhattan', pixel_path='/vpixel.gif', host_map=None, buffer_writes=True)[source]¶