Created
July 20, 2016 16:24
-
-
Save jennyd/120245e11a136cf6ca447699a93f34ce to your computer and use it in GitHub Desktop.
Getting pageview data from performance platform for a given GOV.UK path and time period
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from performanceplatform.client import DataSet | |
query_parameters = { | |
'group_by': 'pagePath', | |
'period': 'day', | |
'start_at': '2016-07-18T00:00:00Z', | |
'end_at': '2016-07-20T00:00:00Z', | |
'collect': 'uniquePageviews:sum', | |
'filter_by': 'pagePath:/pay-council-tax/lambeth' | |
} | |
data_set = DataSet.from_group_and_type('https://www.performance.service.gov.uk/data', 'govuk-info', 'page-statistics') | |
data_set.get(query_parameters) | |
# Returns: | |
# {u'warning': u'Warning: This data-set is unpublished. Data may be subject to change or be inaccurate.', u'data': [{u'values': [{u'_end_at': u'2016-07-19T00:00:00+00:00', u'_count': 1.0, u'uniquePageviews:sum': 20.0, u'_start_at': u'2016-07-18T00:00:00+00:00'}, {u'_end_at': u'2016-07-20T00:00:00+00:00', u'_count': 1.0, u'uniquePageviews:sum': 17.0, u'_start_at': u'2016-07-19T00:00:00+00:00'}], u'pagePath': u'/pay-council-tax/lambeth', u'_count': 2.0, u'_group_count': 2, u'uniquePageviews:sum': 37.0}]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment