Implementation
  • 28 Apr 2023
  • 1 Minute to read
  • Dark
    Light

Implementation

  • Dark
    Light

Article Summary

This page describes the steps you need to take to bypass G2's user login gate and display the G2 review form within your website or application.

Before getting started

Before you begin implementation, you must contact G2 to obtain the following information.

ItemDescription
Partner URLG2 generates a base Partner URL for your product, which you will use to request a token and access your review form.

Partner URLs use the following format:

https://www.g2.com/partnerships/{PARTNER_NAME}

API tokenYour API token is used to authenticate requests for review form access tokens.

API calls must be made server-side, and you should never expose your API token to the client.

Product IDG2 assigns an ID to each of your products listed on G2. You will send your product ID with your API token in your request for a review form access token.

1. Request a review form access token

To request an access token from G2, send a server-to-server POST request to your base Partner URL using your API token and product ID.

You must request an access token for each user. Access tokens expire after 24 hours.

Endpoint

POST /tokens

Query parameters

ParameterData typeDescription
api_tokenstringYour API token.
product_idstringThe ID for your product.

Sample request

curl --request POST 'https://www.g2.com/partnerships/{PARTNER_NAME}/tokens?api_token={API_TOKEN}&product_id={PRODUCT_ID}'

Sample response

{state: 'ae56732be0979829505a0997121a83f5742776b5d21b4cf0'}

2. Create the review form URL

To generate a review form URL that bypasses the G2 login gate, append your review form access token and the user’s email as query parameters.

Endpoint

/users/login.embed

Query parameters

ParameterData typeDescription
statestringYour review form access token.
emailstringThe user’s URL-encoded email address.

Sample review form URL

https://www.g2.com/partnerships/{PARTNER_NAME}/users/login.embed?state={STATE}&email={USER_EMAIL}

For example, the review form URL for G2’s own in-app prompts might look like the following:

https://www.g2.com/partnerships/G2/users/login.embed?state=ae56732be0979829505a0997121a83f5742776b5d21b4cf0&email=documentation%40g2%2Ecom

3. Display your G2 review form

After building the review form URL, G2 offers two options for presenting your review form to users.

For recommendations on building your in-app prompt experience, refer to the Building your prompt section

Link via anchor tag

Adding the review form URL to an anchor tag or the onclick action of a button enables your users to bypass the G2 login gate and complete their review on G2.com.

<a href="https://www.g2.com/partnerships/{PARTNER_NAME}/users/login.embed?state={STATE}&email={USER_EMAIL}">Review us on G2!</a>

external link option

Embed via iframe

To embed your G2 review form in-app, you can add the review form URL to an iframe.

<iframe src="https://www.g2.com/partnerships/{PARTNER_NAME}/users/login.embed?state={STATE}&email={USER_EMAIL}"></iframe>

embed survey option