Toggle the One Tap display with cookies

In dynamically generated HTML pages, you're able to include the g_id_onload ID when the login is required and remove it after a user session is established. However, to toggle the One Tap display for your static HTML pages, you can't change the HTML content.

The way that you can set up One Tap to toggle its display status is to specify a cookie with the data-skip_prompt_cookie attribute. If the cookie isn't set, or the value is empty, our client library functions normally. Otherwise, the client library stops running and One Tap isn't displayed.

You can set your cookie name with the following code snippet:

<div id="g_id_onload"
     data-client_id="YOUR_GOOGLE_CLIENT_ID"
     data-login_uri="https://your.domain/your_login_endpoint"
     data-skip_prompt_cookie="sid">
</div>