Esempio n. 1
0
def main(argv = []):
    # Step 1. Get an analytics service object.
    service = ga_auth.initialize_service()

    try:
        # Step 3. Query the Core Reporting API.
        results = get_results(service)
        print results
        # Step 4. Output the results.
        save_results(results)

    except TypeError, error:
        # Handle errors in constructing a query.
        print ('There was an error in constructing your query : %s' % error)
Esempio n. 2
0
def main():
    # Step 1. Get an analytics service object.
    service = ga_auth.initialize_service()

    try:
        # Step 3. Query the Core Reporting API.
        results = get_results(service)
        # for result, value in results.items():
        #     print result + ': ' + str(value)
        # print len(results)
        # Step 4. Output the results.
        save_results(results)

    except TypeError, error:
        # Handle errors in constructing a query.
        print ("There was an error in constructing your query : %s" % error)
Esempio n. 3
0
def main(*argv):
    # Step 1. Get an analytics service object.
    service = ga_auth.initialize_service()

    try:
        # Step 2. Get the user's first profile ID.
        profile_id = '55777084'

        if profile_id:
            # Step 3. Query the Core Reporting API.
            get_results(argv[0], service, profile_id)
            # Step 4. Output the results.
            # save_results(results)

    except TypeError, error:
        # Handle errors in constructing a query.
        print ('There was an error in constructing your query : %s' % error)
Esempio n. 4
0
def main(argv):
  # Initialize the Analytics Service Object
  service = ga_auth.initialize_service()

  try:
    # Query APIs, print results
    profile_id = get_first_profile_id(service)

    if profile_id:
      total_visits = get_visits(service, profile_id)
      print_results(total_visits)
      referrals = get_referrals(service, profile_id)
      print_referrals(referrals)

  except TypeError, error:
    # Handle errors in constructing a query.
    print ('There was an error in constructing your query : %s' % error)