Terms of Service redirect sending me to sign-up page

63 views
Skip to first unread message

josh powell

unread,
Aug 18, 2015, 11:20:58 AM8/18/15
to Google Analytics Management API
Here is the question in a bit more detail.

I have a tool that utilizes the Analytics API(s) to provision client accounts.

The basic workflow is:
1) sign into a client's email address.
2) generate an auth code.
3) generate a temporary auth token using the auth code.
4) using the auth token, hit this end point "https://www.googleapis.com/analytics/v3/provisioning/createAccountTicket" and grab the account ticket id.
5) using account ticket id, redirect the user to this url "https://www.google.com/analytics/web/#management/TermsOfService//?api.accountTicketId=" plus the account ticket id.
6) the user accepts, and the google redirects back to my page (redirect_uri), thus ending the program.

Now, for email addresses that have > 0 Analytics accounts, google actually sends me to the Terms of Service page, where I can then click accept, and finish the program.
But for email addresses that have 0 Analytics accounts, google is 302ing me to this url: "https://www.google.com/analytics/web/provision?et=&authuser=#provision/SignUp/".
I can create a "dummy" account, then run the program again, and everything is aces.


FireFox Console results difference showing 302 redirect:
NOT WORKING EXAMPLE:
GET
https://www.google.com/analytics/web/#management/TermsOfService// [HTTP/2.0 302 Found 253ms]
GET
https://www.google.com/analytics/web/provision

WORKING EXAMPLE:
GET
https://www.google.com/analytics/web/#management/TermsOfService// [HTTP/2.0 200 OK 749ms]

Same results for Chrome and Firefox.

Devguide  (User Accepts TOS)

createAccountTicket


This is obviously frustrating because the tool is meant to take away the need to manually set up an Analytics account. But, in order for it to work correctly, per the APIs specs, I have to manually set up account, thus negating the tools usefulness.

Can anyone shine any light on this? Thanks!

Matthew Cohoon

unread,
Aug 18, 2015, 2:06:21 PM8/18/15
to Google Analytics Management API
Hi Josh,
Can you clarify if you get this redirect for email addresses without a Google Account or for those without a Google Analytics Account.
-Matt

--
You received this message because you are subscribed to the Google Groups "Google Analytics Management API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-analytics-mana...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Vu Joshua

unread,
Aug 18, 2015, 2:25:46 PM8/18/15
to google-analytic...@googlegroups.com
1. In an Incognito window (no signed-in user) i'm redirected.
2. Signed in with a user without a analytics account i'm redirected as well (https://www.google.com/analytics/web/provision?et=&authuser=#provision/SignUp/)

The 2nd case isn't ideal. We shouldn't have redirect the user there. The user should be directed to the TOS page instead.
The user must have at least one analytics account in order to get to the TOS page. Do we know any frontend developers that can help with this?

Thanks,

Vu, Josh


FYI: Matt here is the code i just ran:

  // my auth flow is different, since the response URI must be the same as the auth URI
  ... 
   GoogleAuthorizationCodeFlow flow =
          new GoogleAuthorizationCodeFlow.Builder(
                  httpTransport,
                  JSON_FACTORY,
                  clientID,
                  clientSecret,
                  ImmutableSet.of(ANALYTICS_EDIT, ANALYTICS_PROVISION, ANALYTICS_MANAGE_USERS))
              .setDataStoreFactory(dataStoreFactory).build();
      return new AuthorizationCodeInstalledApp(flow, new LocalServerReceiver.Builder().setPort(8080).build()).authorize("user");
...

    AccountTicket accountTicket = new AccountTicket()
        .setRedirectUri("http://localhost:8080/Callback")
        .setAccount(new Account()
            .setName("Test provisioning Account"))
        .setWebproperty(new Webproperty()
            .setName("Test Provisiong Web Property")
            .setWebsiteUrl("http://www.joshuavu.com"))
        .setProfile(new Profile()
            .setName("Test Provisioning View"));
    AccountTicket provisioningResult = a.provisioning().createAccountTicket(accountTicket).execute();
    System.out.println(provisioningResult.toPrettyString());
    System.out.println(provisioningResult.getId());
    System.out.println("https://www.google.com/analytics/web/#management/TermsOfService//?api.accountTicketId=" + provisioningResult.getId());


Thanks,

Vu, Josh

josh powell

unread,
Aug 18, 2015, 3:12:45 PM8/18/15
to Google Analytics Management API
Hi Matt, I get this redirect for email addresses without a Google Analytics Account. 
To unsubscribe from this group and stop receiving emails from it, send an email to google-analytics-management-api+unsubscribe@googlegroups.com.

Matthew Cohoon

unread,
Sep 11, 2015, 11:12:03 AM9/11/15
to Google Analytics Management API, jpo...@boomtownroi.com
Hi Josh P.
I wanted to give you an update that yesterday we announced the addition of a new parameter to the Provisioning API TOS URLprovisioningSignup=false, which fixes the issue of provisioning a Google Analytics account for a user without any Google Analytics accounts. You should update your code to add this parameter to the TOS URL.
-Matt

On Tue, Aug 18, 2015 at 8:20 AM, josh powell <jpo...@boomtownroi.com> wrote:

--
You received this message because you are subscribed to the Google Groups "Google Analytics Management API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-analytics-mana...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages