Skip to main content

Server-Side Tagging

Rokt Ads clients set up for server-side tagging via Google Tag Manager can leverage Rokt's Event API to integrate conversion data in real-time.

Use Case Limitations

Server-side tagging is only applicable to advertisers for the purpose of conversion reporting due to its decoupling from the front-end application

Identifiers for Conversion Reporting

Advertisers are strongly recommended to use a persistent identifiers (e.g. email or hashed email values) to close the loop. Persistent identifiers allow Rokt to more accurately attribute conversions back to the original referral events across channels and over time.

However, should you require PII-less conversion reporting, please speak to your account manager about using the Rokt ID as an identifier.

sGTM integration swimlanes diagram

Reporting conversions using the Event API from a server-side container involves the following steps, which map to the numbers in the diagram above.

Location of Identifier

Steps 1 and 2 below assume that an identifier necessary for attribution must first be passed from the client-side app to the server-side container. If an identifer already exists server-side, you can skip these steps.

  1. [ Client-side ] Persist the identifier of choice through to the conversion events.

    • The identifier (e.g. email, Rokt ID) can be persisted by pushing its value to the client-side dataLayer on the landing page.
    • Then, upon each conversion, incorporate the value as a GA4 Event parameter to then be sent towards your server-side container.
  2. [ Client → Server ] Upon conversion, send the identifier to your server container via a GA4 Event.

    • sGTM GA4 Event Config
    • The trigger rule for the GA4 Event should be tied to the conversion event.
  3. [ Server-side ] Claim the RTID-containing request with a GA4 Client.

  4. [ Server-side ] Based on the incoming GA4 event name, conditionally fire an HTTP Request Tag to send a POST request toward Rokt’s Event API endpoint (https://api.rokt.com/v2/events). Reference the Event API documentation for details on how to authenticate and interface with the API, including how to construct a valid payload.

    • Ensure to include a metaData object with key/value pairs: { "name": "source", "value": "sgtm" }
    • If request is successful, the tag should receive back a 200 response with the body: {"data":{"unprocessedRecords":[]}}
    • sGTM HTTP Request
Verifying Conversions Received

As part of the QA process, your account manager will verify that all conversions have been received correctly by Rokt.

Conversion Reporting API

For use cases that do not involve PII of any kind, Rokt also exposes a GET endpoint (https://apps.rokt.com/api/conv) for conversion reporting, which expects the below query parameters. When possible, Event API should be preferred due to its security and flexibility over the Conversion Reporting API.

ParameterDefinitionRequiredExample
idYour Rokt account IDTrue3051387316918867566
passbackconversiontrackingid32-character ID used for PII-less conversion reportingTrueqjkp3xy7dtf9wvneazc5r2bh8ls1m06g
conversiontypeA string to differentiate between different conversion eventsOptional (unless reporting multiple events)signup, purchase, freetrial
Was this article helpful?