Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Analytics API calls fails authentication #2

Open
chrisle opened this issue Nov 18, 2013 · 1 comment
Open

Google Analytics API calls fails authentication #2

chrisle opened this issue Nov 18, 2013 · 1 comment

Comments

@chrisle
Copy link
Owner

chrisle commented Nov 18, 2013

But I got this report twice via email and tried it myself just now. Definitely an issue. It's possibly due to an external change in the API but I don't know yet.

I'm doing this outside my 9 to 5, so any help would be appreciated!

@baz
Copy link

baz commented Nov 18, 2013

I use 2-factor auth so I generated a new one-off app password.

The end-result for this should be the same as if I had entered in my Google username and password.

I then copied and pasted https://github.com/chrisle/seer.js/blob/master/build/seer.js into the Script Editor and saved it.

I wanted to get a GA function executing and returning results so I found getGaKeywordCount() which had the smallest number of arguments and tried to call it.

In A2 of Sheet1 I entered the following:
=getGaKeywordCount(1,A4,A5)

I couldn't figure out how to enter date objects into Google Docs so I modified the source code instead.

Here's what I replaced getGaKeywordCount() with:

function getGaKeywordCount(profileId, startDate, endDate) { 
  var sd = new Date(2013,10,2);
  var ed = new Date(2013,11,2);

  return (SeerJs.Error.hasOccurred()) 
      ? SeerJs.Error.get() 
      : SeerJs.GaApi.keywordCount(1, sd, ed); 
}

After that, A2 started returning me figures. And whenever I adjusted the date ranges inside of getGaKeywordCount() I'd get different values.

And that was the extent of my explorations into SEO Toolbox.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants