Page Summary
-
Conversion tracking for Reservations Business Link Integration involves collecting, persisting, and sending the
rwg_tokenwithout using Google Analytics or other 3rd party javascript. -
Conversion tracking can be implemented at either the device level or the user level, depending on your product architecture.
-
The
rwg_tokenis a unique query parameter appended toaction_linkURLs and must be parsed and stored for up to 30 days. -
To send conversion data, an HTTP POST request containing the
conversion_partner_idandrwg_tokenshould be sent to the specified conversion endpoint. -
Google's standard for conversion attribution is a 30-day window for any interaction with a place link, and conversion events should be sent from all user surfaces.
Overview
Conversion tracking keeps the track of conversions initiated by Google
through one of our Action Center integrations. It helps to
keep your integration healthy and running, as it can influence the
ranking on certain pages. Each time Google generates an action_link, the
specific URL is modified to include a unique query parameter: rwg_token. Store
the token along with the landing merchant identifier, and return the rwg_token
and merchant_changed values when a user completes a reservation.
To complete the integration, follow these steps:
- Parse the
rwg_tokenand identify the merchant. - Store the
rwg_tokenandmerchant_id. - Return the
rwg_tokenandmerchant_changedvalues. - Test and verify the conversion tracking.
Parse the rwg_token and identify the merchant
To complete the integration, you must capture both the rwg_token from the
Google referral URL and the identifier of the landing merchant so you can store
them together for 30 days.
Parse the rwg_token
When a user is directed to your reservation page, Google appends a unique
rwg_token query parameter to the action_link URL you provided in your feeds.
The rwg_token value is an encrypted string generated by Google that contains
metadata about the referral. Because the token is opaque to partners, you cannot
extract the merchant identifier from it.
In your reservation page, parse the rwg_token value from the URL. The
following example shows how to parse the rwg_token in a browser for
device-level tracking:
const rwgToken =
new URLSearchParams(location.search).get('rwg_token') || undefined;
Identify the merchant
When a user is directed to your reservation page, you also need to identify the landing merchant so you can determine later whether the user completed a reservation with the same merchant or a different merchant.
function getLandingMerchantId() {
// TODO: Implement this function to return a unique identifier (string) for
// the merchant the user landed on (for example, parsed from your action link
// URL path, query parameters, or landing page context).
}
const merchantId = getLandingMerchantId();
Store the rwg_token and merchant_id
After parsing the rwg_token and identifying the landing merchant, store both
values together. You can implement conversion tracking storage at two different
levels:
- Device-level
- User-level
You can store the values at either level, but you must store both the
rwg_token and merchant_id for 30 days after the initial referral.
The following example shows device-level storage in a browser using first-party
cookies. It assumes you parsed rwgToken and identified merchantId as shown
in the previous section. Each cookie must be written in its own
document.cookie assignment. Make sure to update
rootdomain.com with your domain.
// Store rwgToken and merchantId in separate first-party cookies with a 30-day
// expiration (2592000 seconds).
if (rwgToken !== undefined) {
const cookieAttrs =
'; max-age=2592000; domain=rootdomain.com; path=/';
document.cookie = '_rwgToken=' + encodeURIComponent(rwgToken) + cookieAttrs;
if (merchantId !== undefined) {
document.cookie =
'_merchantId=' + encodeURIComponent(merchantId) + cookieAttrs;
}
}
Store at device-level
Device-level storage uses browser cookies, local storage, app local storage, or
any other method that can persist the rwg_token and merchant_id for the
30-day attribution window. Because the values are stored locally on the user's
device, the conversion event can't attribute properly if the user:
- Changes the device they use.
- Clears the local storage or cookies.
- Uses a private or incognito browser.
When you use device-level conversion tracking, you need to implement conversion tracking across every supported device, including mobile.
Store at user-level
User-level storage persists the rwg_token and merchant_id in your
application database, through a server-side analytics system, or in another
server-side system. Because the values are stored server-side, the conversion
event still attributes properly after the user logs back in.
When you use user-level conversion tracking based on your system architecture, you can implement the conversion event once on your server-side and reuse it across all supported devices.
Refresh the stored values
When Google refers a user again through an action_link, replace both the
stored rwg_token and the stored merchant_id with the values from the latest
referral. After replacement, the 30-day attribution window resets and any new
conversions attribute to the latest referral.
Refer to Requirements for Conversion Attribution for more details.
Return the rwg_token and merchant_changed values
When a user completes a reservation that begins from an action_link
referral, you need to send an HTTP POST request to the conversion endpoint.
There are two endpoints:
- Production environment: https://www.google.com/maps/conversion/collect
- Sandbox environment: https://www.google.com/maps/conversion/debug/collect
When you send a conversion event, you must include the stored rwg_token
and a merchant_changed integer value of 1 or 2. For more details on
merchant_changed, see Return the merchant change value.
The POST body must be a JSON-encoded object in the format:
{
"conversion_partner_id": "<partnerId>",
"rwg_token": "<rwg_token_val>",
"merchant_changed": 1|2
}
Example payload:
{
"conversion_partner_id": "XXXXXXX",
"rwg_token": "AFd1xnHrJWKcjtriCyB5j3QL0bzbmLdcg1N1f5cJuSNVhteYjuOJz18Au6GIAT0tjHkw6fkUJKcarafV45b3c_gl7uT_o8HMcg==",
"merchant_changed": 2
}
The following example shows device-level conversion tracking reading the stored cookies on the user's device and sending the conversion event in JavaScript:
function getCookie(name) {
const match = document.cookie.match(
new RegExp('(?:^|; )' + name + '=([^;]+)'));
return match ? decodeURIComponent(match[1]) : undefined;
}
function getCurrentMerchantId() {
// TODO: Implement this function to return the unique identifier (string) of
// the merchant where the user completed a reservation, using the
// same identifier format as getLandingMerchantId().
}
const partnerId = XXXXXXXXXX;
const endpoint = 'https://www.google.com/maps/conversion/collect';
// Retrieve the rwgToken and merchantId stored in the browser's cookies.
const storedRwgToken = getCookie('_rwgToken');
const storedMerchantId = getCookie('_merchantId');
// Compare the stored referral merchant ID against the merchant ID where the
// user completed a reservation. If users cannot switch merchants on
// your site, hardcode merchantChanged to 2.
const currentMerchantId = getCurrentMerchantId();
const merchantChanged =
storedMerchantId === String(currentMerchantId) ? 2 : 1;
// Send the conversion event with the URL-decoded token, ensuring special
// characters such as '=' are included.
if (storedRwgToken !== undefined) {
fetch(endpoint, {
method: 'POST',
body: JSON.stringify({
conversion_partner_id: partnerId,
rwg_token: storedRwgToken,
merchant_changed: merchantChanged
})
});
}
Return the merchant change value
The merchant_changed value is used to determine if the merchant changed from
the initial redirect merchant. Change of merchants is common if your landing
page is within a platform that includes other merchants. In this case, if a user
is referred to your platform by Google and decides to navigate to a different
merchant to complete a reservation, Google needs to know that the
conversion happened with a separate merchant. Use the merchant_changed integer
value (1 or 2) to indicate whether the merchant changed, without sending
merchant details.
When deciding which value to assign to merchant_changed, compare the original
merchant identifier stored in
Store the rwg_token and merchant_id against the merchant
that completed a reservation:
- Requirement: when a user leaves the original merchant's website and
completes a purchase through your platform with a different merchant.
- Merchant change value:
1
- Merchant change value:
- Requirement: when the user completes a transaction through the original
merchant.
- Merchant change value:
2
- Merchant change value:
Test and Verify the Conversion Tracking
The following test cases use test tokens provided in the
Test Tokens section and are intended to help guide you through
all of various scenarios that can result in a conversion event. This ensure that
the token is stored appropriately, the merchant_changed value is set
correctly, and the conversion event is sent when appropriate.
Use the action link or reservation page URLs provided in your feeds, and run each test case by appending the Test Tokens to the end of the URL. Be sure to use a private or incognito browser window -- this will clear any existing tokens associated with the current user and give you a clean slate to work with.
| Test Case | Test Description | User Flow | Expected Outcome |
|---|---|---|---|
| 1 | A user completes a reservation that did not originate on Google. | A user navigates directly to the reservation page without being referred to by Google or without an existing referral. This shouldn't result in any conversion event. | No conversion event because the user did not previously visit the reservation page or was not referred by Google. |
| 2 | A user completes a reservation that originated on Google. | A user finds your merchant through Google, is referred to your reservation page and completes a reservation. | A conversion event would be sent with Token A and merchant changed value of 2 because the user was referred to the reservation page by Google. |
| 3 | A user (originating from Google) begins the reservation flow, but abandons the session before a reservation is completed. Note: Keep this session open for Test 4 and 5. |
A user is referred to your reservation page but the session ends and they don't complete a reservation. | No conversion because the user did not complete a reservation but Token B should be stored for 30 days. |
| 4 | A user returns to the reservation page, without having been originating from Google, and completes a reservation. Note: The reservation flow URL must not include an rwg_token. |
A user returns to the reservation page after Test #4. Token B should be stored for 30 days and any conversion during those 30 days should return a conversion event. | A conversion event would be sent with Token B and merchant changed value of 2 because the user is returning to the reservation page after previous referral from Google. |
| 5 | A user completes a new reservation originating from Google after Test #4. | If a user returns to your reservation page using a Google referral after a previous Google referral, their 30-day storage window resets and a new token Token C replaces the old one Token B. All future conversions will then be attributed to Token C. | A conversion event would be sent with Token C and merchant changed value of 2 because the user completed the reservation and the new token replaced the previously stored token. |
If you have a platform with the ability for users to checkout with a different merchant, test the following.
| Test Case | Test Description | User Flow | Expected Outcome |
|---|---|---|---|
| 6 | A user is referred to your reservation page by Google and completes a reservation with a different merchant. | A user is referred to your reservation page by Google, Token A is used, but before completing a reservation they navigate to a different page and complete the reservation with a merchant that differs from the original referral. | A conversion event would be sent because the user completed a reservation that originated with a referral from Google with Token A and merchant changed value of 1 because the user completed the reservation in a different merchant than the referral. |
While you test, send the HTTP POST request to the conversion endpoint. There are two endpoints:
- Production environment: https://www.google.com/maps/conversion/collect
- Sandbox environment: https://www.google.com/maps/conversion/debug/collect
Test Tokens
To test conversion tracking, add one of the following test tokens to the end of the Action links or reservation page URLs you provide in your feeds.
Token A:
rwg_token=AFd1xnHrJWKcjtriCyB5j3QL0bzbmLdcg1N1f5cJuSNVhteYjuOJz18Au6GIAT0tjHkw6fkUJKcarafV45b3c_gl7uT_o8HMcg%3D%3D
Token B:
rwg_token=AE37R_gte8WCEaytMalsIr9agWQRLuN8199RsVhU2WoRKRvcZ0eBTD8cFvnfUZh-GY0IvY-zjS3W9KWAmy3WDiWXbVvQRZyzMQ%3D%3D
Token C:
rwg_token=AE37R_jmAP-UgWNApkxwdlX5M2z1UBGuUzHZ63YWmRWeTjRJKxfSD1mzJ4joLnB11MHrBULuisjP-9I64LnBJDXyCc_CIJSCPg%3D%3D
When you send the successful conversion events, you can see them aggregated in the Action Center under the conversion tracking dashboard.
![]()
Requirements for Conversion Attribution
Google's required standard for conversion attribution is a 30 days attribution window for any interaction with a place action link, at any store.
This attribution window means that Google can expect a conversion event to be sent in any of the following scenarios:
- A user follows a place action link and places an order for the same merchant in the same session. Merchant change value = 2.
- A user follows a place action link and then returns from a different channel within the 30 days attribution window to place an order for the same merchant. Merchant change value = 2.
- A user follows a place action link and then places an order at a different store, either within the same session or a different session within a 30 days attribution window. Merchant change value = 1.
Additionally, Google expects to send conversion events from any device, a user can access through a place action link. These devices include:
- Desktop or mobile web applications.
- Mobile apps, either through an app deep link or a registered app-intent for your domain.
If the token is stored at the user-level, it's expected that you provide cross-device attribution. For more information, see Store at User-Level. In this case, a user who follows an action link from the desktop and then completes the transaction on mobile with the same user account, must trigger a conversion event.
If the token is stored exclusively at the device-level, such as in browser cookies, it's not expected that you provide cross-device attribution. In this case, each device can have a separate token persisted, if the user follows an action link on that device, and each device can follow the attribution rules separately.