Re: [GA-API] Digest for google-analytics-data-export-api@googlegroups.com - 10 Messages in 7 Topics

46 views
Skip to first unread message

Nick Blexrud

unread,
Mar 28, 2013, 11:46:11 AM3/28/13
to google-analytics...@googlegroups.com



On Thu, Mar 28, 2013 at 7:36 AM, <google-analytics...@googlegroups.com> wrote:

Group: http://groups.google.com/group/google-analytics-data-export-api/topics

    Preet Sandhu <preet....@gmail.com> Mar 28 07:15AM -0700  

    For anybody looking for a soluion to my question - It seems the IP was
    unblocked atuomatically after a week.

    It is working for me now.

    Thanks,
    Preet
     
    On Friday, March 22, 2013 11:44:26 AM UTC-4, Preet Sandhu wrote:
     

     

    "Андрей Коваль" <andrey.m...@gmail.com> Mar 28 03:25AM -0700  

    Hello!
    For the very begining, sorry for my English. I am from Ukraine, and dont
    speak english fluent. I want to ask you for help guru
    developers-programmers.
    I have a problem. My boss gave me task import the data from google
    analytics into a file in order to make it easier to analyze. Iam not a
    developer, my first meeting with google api useing python was here(
    https://developers.google.com/analytics/solutions/articles/hello-analytics-api
    ) I made it its connects to google and show me data in cmd. Its great.
    We have about 250 company accounts in our analitic profile, we need to get
    from them:
    1. Visits(in, out)
    2. Goals(achieving)
    3. Depth session
    All this data need to be get and saved in csv.
    All this we need to do useing Python.
    Useing manuals tutorials, working demo and other stuff on google site i
    made api that get top key word and source of visits, get webpropertis of
    account.
    Maybe i dont undrestand truly how to develop web aplications and other, iam
    just begin to study. So help please. to made such application
     
    Questions:

    To get top key word i used this
    def get_top_keywords(service, profile_id):
    return service.data().ga().get(
    ids='ga:' + profile_id,
    start_date='2013-03-01',
    end_date='2013-03-25',
    metrics='ga:visits',
    dimensions='ga:source,ga:keyword',
    sort='-ga:visits',
    filters='ga:medium==organic',
    start_index='1',
    max_results='25').execute()
    what comand i need to use to get Visits Goals depth sessions
    I have been looking for some sort of ga api coomand list but not result.
     
    Second: my api shows me only one company instead of 250 that we have in
    account:
    to show i use:
     
    def get_first_profile_id(service):
     
    accounts = service.management().accounts().list().execute()
     
    if accounts.get('items'):
    firstAccountId = accounts.get('items')[0].get('id')
    webproperties = service.management().webproperties().list(
    accountId=firstAccountId).execute()
     
    if webproperties.get('items'):
    firstWebpropertyId = webproperties.get('items')[0].get('id')
    profiles = service.management().profiles().list(
    accountId=firstAccountId,
    webPropertyId=firstWebpropertyId).execute()
     
    if profiles.get('items'):
    return profiles.get('items')[0].get('id')
     
    return None
    what i need to use to make programm show others profile information.
     
    Down is whole code of my api Maybe you can help me some how.
    Thank you very much for your attention.

    import sys
    import sample_utils
     
    from apiclient.errors import HttpError
    from oauth2client.client import AccessTokenRefreshError
     
     
    def main(argv):
    sample_utils.process_flags(argv)
     
    service = sample_utils.initialize_service()
     
    try:
    first_profile_id = get_first_profile_id(service)
    if not first_profile_id:
    print 'Could not find a valid profile for this user.'
    else:
    results = get_top_keywords(service, first_profile_id)
    print_results(results)
     
    except TypeError, error:

    print ('There was an error in constructing your query : %s' % error)
     
    except HttpError, error:

    print ('Arg, there was an API error : %s : %s' %
    (error.resp.status, error._get_reason()))
     
    except AccessTokenRefreshError:

    def get_first_profile_id(service):
     
    accounts = service.management().accounts().list().execute()
     
    if accounts.get('items'):
    firstAccountId = accounts.get('items')[0].get('id')
    webproperties = service.management().webproperties().list(
    accountId=firstAccountId).execute()
     
    if webproperties.get('items'):
    firstWebpropertyId = webproperties.get('items')[0].get('id')
    profiles = service.management().profiles().list(
    accountId=firstAccountId,
    webPropertyId=firstWebpropertyId).execute()
     
    if profiles.get('items'):
    return profiles.get('items')[0].get('id')
     
    return None
     
    def get_top_keywords(service, profile_id):
     
    return service.data().ga().get(
    ids='ga:' + profile_id,
    start_date='2013-03-01',
    end_date='2013-03-25',
    metrics='ga:visits',
    dimensions='ga:source,ga:keyword',
    sort='-ga:visits',
    filters='ga:medium==organic',
    start_index='1',
    max_results='25').execute()
     
     
    def print_results(results):
     
    print
    print 'Profile Name: %s' % results.get('profileInfo').get('profileName')
    print
     
    output = []
    for header in results.get('columnHeaders'):
    output.append('%30s' % header.get('name'))
    print ''.join(output)
     
    if results.get('rows', []):
    for row in results.get('rows'):
    output = []
    for cell in row:
    output.append('%30s' % cell)
    print ''.join(output)
     
    else:
    print 'No Rows Found'
     
     
    if __name__ == '__main__':
    main(sys.argv)

     

    James Standen <ja...@nmodal.com> Mar 28 07:14AM -0700  

    Hello,
     
    Another possibility is to use one of the many tools available in the
    application gallery to export the data.
     
    The application gallery for Google Analytics is here -
    http://www.google.com/analytics/apps/
     
    I am the founder of one of them, Analytics Canvas, which is well suited to
    pulling data from hundreds of accounts..
     
    My website http://www.analyticscanvas.com
     
    We have a 30 day free trial, it may be you can get the file you need using
    that, and if this is something you need to do regularly long term, see if
    our company plan works for you.
     
    Regards,
     
    James
     
    On Thursday, March 28, 2013 6:25:30 AM UTC-4, Андрей Коваль wrote:

     

    Remco Borst <remco...@live.nl> Mar 28 04:15AM -0700  

    I have the same problem.. I could not find that this is possible anywhere.
    Hopefully someone could come up with an answer.

     

    "Jeetendra S." <jso...@google.com> Mar 27 11:24PM -0700  

    You need to add all the domains that you plan to issue API requests from to
    your Client ID settings in the APIs console.
     
    Under APIs console, click on API Access Pane, then click on Edit Settings
    for your Client ID. There you can add more than one domain under Authorized
    JavaScript Origins.
     
     
     
    On Monday, March 25, 2013 8:11:14 AM UTC-7, avinash kenjale wrote:

     

    J <ja...@sumall.com> Mar 27 09:46AM -0700  

    I've noticed that the reporting API will return "rateLimitExceeded" (403
    error code) throughout the day even though my application is nowhere near
    the quota limits.
     
    Here's the error:
    [{"domain":"global","message":"Quota Error: Rate Limit
    Exceeded","reason":"rateLimitExceeded"}]
     
    BTW, I don't see "rateLimitExceeded" on the reference page for errors:
    https://developers.google.com/analytics/devguides/reporting/core/v3/coreErrors
     
    More recently, this error seems to occurring more and more frequently,
    which is causing a big problem for our application/system.
     
    Can someone explain why we are receiving this error? Any remedies?
     
    Any help would be greatly appreciated. Thanks!

     

    "Jeetendra S." <jso...@google.com> Mar 27 11:11PM -0700  

    The error code userRateLimitExceededUnregUser suggests that you are sending
    unregistered requests to the API. You need to register with Google APIs
    console and create a project there. We also recommend that you set up OAuth
    2.0 for your project, which automatically sends the client_id for your
    project with each API request.
     
    You can read more about this in our docs.
     
    https://developers.google.com/analytics/devguides/reporting/core/v3/coreDevguide#before
     
     
     
    On Tuesday, March 26, 2013 6:58:33 AM UTC-7, Preet Sandhu wrote:

     

    James Standen <ja...@nmodal.com> Mar 27 08:34PM -0700  

    Hi Aaron,
     
    I'm seeing the same thing, have contacted someone at Google.
     
    On Wednesday, March 27, 2013 8:04:18 PM UTC-4, Aaron Toledo wrote:

     

You received this message because you are subscribed to the Google Group google-analytics-data-export-api.
You can post via email.
To unsubscribe from this group, send an empty message.
For more options, visit this group.

--
You received this message because you are subscribed to the Google Groups "Google Analytics Reporting API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-analytics-data-...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
- Nick
Reply all
Reply to author
Forward
0 new messages