Plugins Reference

These classes provide some wrappers around plugin methods.

PiwikGoals

class piwikapi.plugins.goals.PiwikGoals(api_url)

Initialize a PiwikAnalytics object

Parameters:api_url (str) – Piwik API url, root of the install
Return type:None
add_goal(id_site, name, match_attribute, pattern, pattern_type, token_auth, case_sensitive=False, revenue=False, allow_multiple_conversions_per_visits=False)

Create a goal

Parameters:
  • id_site – Site ID
  • name – Name of the goal
  • match_attribute – ‘url’, ‘title’, ‘file’, ‘external_website’ or ‘manually’
  • pattern – eg. purchase-confirmation.htm
  • pattern_type' – ‘regex’, ‘contains’, ‘exact’
  • case_sensitive (bool) – Case sensitive
  • revenue – Revenue per action
  • allow_multiple_conversions_per_visits (bool) – By default, multiple conversions in the same visit will only record the first conversion. If set to true, multiple conversions will all be recorded within a visit (useful for Ecommerce goals)
Return type:

int, ID of the new goal

delete_goal(id_site, id_goal)

Delete a goal

Parameters:
  • id_site – Site ID
  • id_goal – Goal ID