Pavel Kolesnikov
posted this on September 30, 2009 08:04
We've created a cool new tool to help you extract data from Google Analytics and create CSV files that can be uploaded to Good Data. This simple utility accepts command line arguments as follows:
-u Login name for your Google Account (required)
-p Password for your Google Account (required)
-f Your Google Analytics profile ID (the number used in your Google Analytics code snippet) (required)
-o File to write the output CSV (standard output by defaults
-d Dimensions to be displayed in your report (default: ga:date)
-m Metrics to be displayed in your report (default: ga:visits,ga:visitors,ga:pageviews)
-h Print a help screen
-n Do not print the header row
-s Fetch data starting at day (YYYY-MM-DD) (default: a week ago = 2009-09-23)
-e Fetch data up to day (YYYY-MM-DD) (default: today = 2009-09-30)
--start-index Index of the first result to fetch (default: 1). Use the start-index along with the max-results parameter to page through larger blocks of data
--max-results Maximum number of entries to return (default: 1000). Use the max-results along with the start-index parameter to page through larger blocks of data
Example 1: the following call will dump a CSV file including number of visits, page views and new visits from United States per day for the first week of year 2009:
java -jar GoogleAnalyticsClient-20100702.jar -u foo@bar.com -p mypassword -f 123456 \
-d ga:date -m ga:visits,ga:pageviews,ga:newVisits \
-s 2009-01-01 -e 2009-01-07 --filters="ga:countr==United States"
Example 2: the following call can be used to get a paged set of CSV files including number of visits, page views and new visits per day and country for the year 2009. This particular call fetches up to 2000 rows starting from the row number 2001:
java -jar GoogleAnalyticsClient-20100702.jar -u foo@bar.com -p mypassword -f 123456 \
-d ga:date,ga:country -m ga:visits,ga:pageviews,ga:newVisits \
-s 2009-01-01 -e 2009-12-31 --start-index=2001 --max-results=2000
The number of returned rows is limited to 10,000 by Google Analytics. This tool returns up to 1,000 rows by default; use the --max-results option to override this default. The --start-index option can be used to page through larger block of data.
For information on valid dimension and metric names, please refer to Google Analytics Documentation at http://code.google.com/apis/analytics/docs/gdata/gdataReferenceDimensionsMetrics.html
For information about valid dimension and metric combinations please refer to http://code.google.com/apis/analytics/docs/gdata/gdataReferenceValidCombos.html
Queries involving more than 7 dimensions are not supported by Google Analytics.
To download the utility, right click the file link below and select "Save As..."
2010-07-02
Minor distribution clean-up
2010-06-23
Added support for accessing Google Analytics via non-gmail accounts. Note: Google Apps accounts are not supported by GA.
Added --filters option to provide filter expression as described in the Google Analytics documentation.
Added --max-results option to override the default limit of returned page (only limits up to 10,000 are supported by Google Analytics) and --start-index to support paging through larger results
Initial version published.
Comments
Como executamos este arquivo jar no eclipse.
?