コード例 #1
0
ファイル: main_extract.py プロジェクト: chonhan/metrics
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)
コード例 #2
0
ファイル: moztech_extract.py プロジェクト: kdchang/metrics
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)
コード例 #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)
コード例 #4
0
ファイル: getstuff.py プロジェクト: DavyLandman/TuringLEGO
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)