Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear Colleagues.
Could you help me to resolve authorization problem in GA?
I use GoogleAnalyticsClient.
So, here is my script:
// Google Analytic settings
SET gUserName='My email';
SET gPassword='My password';
SET gProfileId='My profile';
// Date period
SET gDateStart='2014-01-01';
SET gDateEnd='2014-01-07';
// Dimensions & Metrics Reference
SET gDimensions='ga:date,ga:country';
SET gMetrics='ga:visits,ga:pageviews,ga:newVisits';
// Fetch data from Google Analytics into visits.csv
/*
-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)
*/
EXECUTE java -jar GoogleAnalyticsClient-20100127.jar -u $(gUserName) -p $(gPassword) -f $(gProfileId) -d $(gDimensions) -m $(gMetrics) -s $(gDateStart) -e $(gDateEnd) -o visits.csv;
After loading the csv. file is empty.
When I'm checking JAVA command in cmd, i have an error "invalid credentials".
Here is an error text
Exception in thread "main" com.google.gdata.client.GoogleService$InvalidCredenti
alsException: Invalid credentials
at com.google.gdata.client.GoogleAuthTokenFactory.getAuthException(Googl
eAuthTokenFactory.java:586)
at com.google.gdata.client.GoogleAuthTokenFactory.getAuthToken(GoogleAut
hTokenFactory.java:490)
at com.google.gdata.client.GoogleAuthTokenFactory.setUserCredentials(Goo
gleAuthTokenFactory.java:336)
at com.google.gdata.client.GoogleService.setUserCredentials(GoogleServic
e.java:362)
at com.google.gdata.client.GoogleService.setUserCredentials(GoogleServic
e.java:317)
at com.google.gdata.client.GoogleService.setUserCredentials(GoogleServic
e.java:301)
at com.gooddata.pmktg.util.GoogleAnalyticsClient.run(Unknown Source)
at com.gooddata.pmktg.util.GoogleAnalyticsClient.main(Unknown Source)
Best regards.
Oleg.
Problem solved.
I wasn't an owner of account.
thanks.