Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Querying Multi-Channel Funnels Reporting API #41

Open
Atlasp opened this issue Mar 13, 2018 · 4 comments
Open

Querying Multi-Channel Funnels Reporting API #41

Atlasp opened this issue Mar 13, 2018 · 4 comments

Comments

@Atlasp
Copy link

Atlasp commented Mar 13, 2018

I've been using :

query = {
        'reportRequests': [
        {
          'viewId': 'viewid',
          'dateRanges': [{'startDate': '2018-02-01', 'endDate': '2018-02-28'}],
          'metrics': [{'expression': 'ga:adClicks'},
                      {'expression': 'ga:adCost'},
                      {'expression': 'ga:CPC'},
                      {'expression': 'ga:sessions'},
                      {'expression': 'ga:bounceRate'},
                      {'expression': 'ga:pageviewsPerSession'},
                      {'expression': 'ga:goal6ConversionRate'},
                      {'expression': 'ga:goal6Completions'},
                      {'expression': 'ga:goal6Value'}],
          'dimensions': [{'name': 'ga:campaign'},
                         {'name': 'ga:date'}]
        }]
      }


conn = GoogleAnalyticsQueryV4(secrets='secret.json')
df = conn.execute_query(query)

print(df)

with success, however, I am unable to query data from Multi-Channel Funnels Reporting API, are there any examples how to modify the query so mcf dimensions and metrics would be usable?

@DeliciousHair
Copy link
Contributor

I have not been using any of these tools (GA) at all recently, and as a result I don't have a quick-fix answer that I can promise will work.

However, the V4 api is much simpler than the V3, and GoogleAnalyticsQueryV4 is basically a convenience wrapper for googleapiclient.discovery.build, which requires a serviceName argument. At the moment, I've hard-coded in a value of analytics, so if you simply make this value a keyword argument to OAuthDataReaderV4._init_service(), then you could subclass out any of the api services like I've done with GoogleAnalyticsQueryV4 in a rather trivial manner.

I won't have time to try this myself for at least a few days at this point; if you work something out please do submit a pr--any and all help appreciated!

Thanks!

@rahulpanchal0002
Copy link

rahulpanchal0002 commented May 29, 2018

I am too facing the same problem. I tried to write the query different ways, but still produces error
ValueError: The (required) 'start_date' parameter is missing or invalid

I have start_date in my query.
Is there any example for building MCF query?

@Archirk
Copy link

Archirk commented Apr 22, 2020

Oh.. two years have passed and answer is still desired.

@DeliciousHair
Copy link
Contributor

Indeed! And now I may be using this again, so I'll try to get to this later in the week. Or so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants