Before you start
- Your advertiser ID. In Events Manager, open Setup, select Or set up manually, and find the Browser conversion tag card. The card shows the tag with your advertiser ID.
- The Gravity Pixel on your website. The tag reads the attribution context that the Pixel stores, so Gravity can connect the conversion to the ad click.
Add the tag to a page
-
Copy the tag from the Browser conversion tag card in Events Manager, or copy this tag:
-
Replace
YOUR_ADVERTISER_IDwith your advertiser ID. -
Set
data-typeto the event. See Event types. -
Set
data-valueto the conversion value, or removedata-valueanddata-currencyif the conversion has no value. - Put the tag on the page that confirms the conversion, for example the order confirmation page.
Event types
Set the event type to the conversion event of your campaign.
For a custom conversion event, use the same event name as in your campaign, in lowercase with underscores. For example, use
demo_request for a campaign with the custom event Demo request.
A signup without a value:
Add the tag with Google Tag Manager
- In GTM, create a Custom HTML tag.
- Paste the tag. To send the value from your data layer, use a GTM variable, for example
data-value="{{Conversion Value}}". - Set the trigger to the page view or the event that confirms the conversion, for example a page view on
/thank-youor apurchasedata layer event. - Publish the container.
Send a conversion from JavaScript
Use JavaScript when the conversion does not load a new page, for example when a form shows a success message.-
Load
conversion.jsonce on the page: -
When the action is confirmed, call
window.gravityConversion:The options areadvertiserId(required),type,value,currency,orderId, andmetadata. They work like the attributes in the table above.
Verify the tag
- Open the page with the tag in a browser.
- Open the developer tools and select the Network tab.
- Find a request to
api.trygravity.com/generic/conversions. Make sure that the response contains"status": "ok".
Update an older tag
Older versions of the tag useddata-api-key or the apiKey option. These tags still work. To update an older tag:
- Replace
data-api-key="..."withdata-advertiser-id="YOUR_ADVERTISER_ID". In JavaScript, replaceapiKeywithadvertiserId. - Publish the change, including a new version of each GTM container.
- Rotate your API key in Settings → Organization, and update your server integrations with the new key.