コード例 #1
0
 def get(self):
     args = parser.parse_args()
     service = GoogleAnalyticsService(self.g_credential)
     analytics_credential = GoogleAnalyticsCredential.get_by_user_id(self.g_credential.key.id())
     if not analytics_credential:
         abort(404, message="there are no Google analytics account associated to this user ")
     profile_id = analytics_credential.profile_id
     data_by_source = service.get_data_by_source(profile_id, ['uniquePageViews'], ['pagePath=~welcome'],
                                                 args["startDate"],
                                                 args["endDate"]).get('rows')
     return {'data': data_by_source}
コード例 #2
0
 def get(self):
     args = parser.parse_args()
     service = GoogleAnalyticsService(self.g_credential)
     analytics_credential = GoogleAnalyticsCredential.get_by_user_id(
         self.g_credential.key.id())
     if not analytics_credential:
         abort(
             404,
             message=
             "there are no Google analytics account associated to this user "
         )
     profile_id = analytics_credential.profile_id
     data_by_source = service.get_data_by_source(
         profile_id, ['uniquePageViews'], ['pagePath=~welcome'],
         args["startDate"], args["endDate"]).get('rows')
     return {'data': data_by_source}