Skip to main content

Reporting conversions

Setting up automatic conversion reporting helps Rokt Ads clients measure the impact of your campaigns on your business. Rokt offers a variety of ways to integrate your conversion data. For greatest accuracy, we recommend using the Rokt Web SDK or Event API. The instructions for each method are listed below.

Though less accurate, we also support conversion reporting through third-party measurement tools, file transfer, and manual upload.

No-code conversion reporting

Shopify store owners can install the Rokt Ecommerce app with one click to start reporting conversion data. Contact your account manager if you'd like to explore the Shopify option.

Web SDK#

The Rokt Web SDK is a snippet of JavaScript code that lets you automatically report conversions from the frontend of your website.

Steps#

  1. Get your unique snippet from your Rokt account manager, or generate it yourself in One Platform.

    1. To obtain your snippet in One Platform log in and go to Integrations > Set up the snippet.

    2. For Snippet goal, select Record conversions.

    3. Choose a customer identifier so that Rokt can correctly match campaign events to conversions. We recommend using raw or hashed (SHA-256) customer email address as an identifier.

      Note: As an alternative to hashed or raw email, you can use the Rokt Tracking ID (passbackconversiontrackingid) as an identifier. This method takes more work from your development team, but doesn’t require any personally identifiable information.

    4. Add relevant contextual attributes. Contextual data helps Rokt learn more about what campaigns and audiences are most effective for your business. We use these learnings to optimize for acquisition and help your campaigns perform better in the future.

      Your snippet will look something like this:

(function(r,o,k,t,n,e,w,a,_){r._ROKT_=n;r[n]=r[n]||{id:t,h:w,lc:[],it:new Date(),onLoaded:function(c){r[n].lc.push(c)}};a=o.createElement('script');a.type='text/javascript';a.async=!0;a.src=k;if(e){a.integrity=e;a.crossOrigin='anonymous'}_=o.getElementsByTagName('script')[0];_.parentNode.insertBefore(a,_)})(window,document,'https://apps.rokt.com/wsdk/integrations/snippet.js','roktAccountid', 'rokt');
rokt.onLoaded(function(rokt) {
  rokt.setAttributes({    //customer identifier - at least one required    email: 'john.smith@gmail.com',    emailsha256: '',    passbackconversiontrackingid:'',
    //recommended contextual attributes    firstname:'',    lastname:'',    conversiontype: '',    amount: '',    currency: '',    quantity: '',    paymenttype: '',    margin: '',    confirmationref: '' });
caution

If you are copying the above example, ensure roktAccountid is replaced with your account's unique ID before continuing to the next step. You can get your roktAccountid from your account manager or from One Platform.

  1. Add the snippet to your confirmation page.

    1. You should place the snippet on any page that immediately follows a conversion event, typically a confirmation or thank you page. Paste the snippet directly into the HTML on the page, between the

      tags.

    2. Ensure that the snippet records all conversions on your site. Rokt can then handle the attribution process to determine what conversions resulted from a Rokt campaign event.

      Tag managers

      You can add the Rokt snippet to your site using a tag manager, but it may result in reduced performance due to some conversion events being dropped. For best results, we recommend the direct integration described on this page.

  2. Populate your data attributes. Ensure that at least your customer identifier (email or Rokt Tracking ID) is populated with the correct data. Also configure any contextual attributes.

    1. If you want to use hashed email address as an identifier, you can use Rokt’s pre-built hashing function by adding this line of code to your snippet:

      rokt.onLoaded(function (rokt) {  const email = "john.smith@rokt.com";  return rokt.hashString(email).then(function (emailsha256) {    rokt.setAttributes({ emailsha256: emailsha256 });  });});
  3. Test that the snippet is engaging and contains the correct data. View testing instructions.

For optimal performance, consider integrating both the Event API and Web SDK. Using both methods creates redundancy and helps identify any anomalies that may occur in the browser or on your server.

Event API#

The Event API offers another options for advertisers looking to integrate conversion data with Rokt. Using the Event API, your backend server can securely connect to Rokt's, transmitting conversion data in real time.

Using the Event API as a standalone integration for conversion data provides multiple benefits:

  • Speed. Enables a fully automated, near-real time data exchange, maximizing the potential of Rokt’s automated optimization tools.
  • Coverage. Permits integration of events across all channels and devices, resulting in coverage for conversions across web, mobile, and in-store.
  • Reliability. As a server-to-server integration, the Event API is not susceptible to any interference by web technologies such as browser or ad blocking. It also supports error handling, ensuring that data is never lost.

Steps#

  1. Make sure you can log in to Rokt's One Platform and obtain your Account ID. If you don't have an account, reach out to your account manager.

  2. Get your App ID and App Secret from One Platform. You need this information in order to authenticate the Event API. You can view steps to retrieve your credentials here.

  3. Assemble your payload for the Event API. You can use the POST /v1/events endpoint to send any type of conversion event to Rokt.

    1. For this use case, always set eventType to conversion so that Rokt knows to trigger the conversion attribution process.

    2. Include relevant key-value pairs in the objectData. Providing relevant contextual data helps Rokt better optimize your campaigns in the future.

      Rokt requires at least one of email (email), SHA-256 hashed email (emailsha256), or Rokt Tracking ID (passbackconversiontrackingid) so that Rokt can identify the customer. Suggested objectData fields are available in the table below.

    Full endpoint reference

    You can view full reference details for the Event API here.

Sample#

POST /v1/events{    "accountId": "12345",    "events": [        {            "clientEventId": "ff3bd69c-ca74-4337-af91-4d5d0bd00e38",            "eventTime": "2020-05-22T10:21:29.339Z",            "eventType": "conversion",            "objectData": [                {                    "name": "email",                    "value": "email123@emailserver.com"                },                {                    "name": "transactionid",                    "value": "123456789"                },                {                    "name": "amount",                    "value": "99.80"                },                  {                    "name": "currency",                    "value": "USD"                },                {                    "name": "quantity",                    "value": "2"                },                {                    "name": "conversiontype",                    "value": "hotel_booking"                },                {                    "name": "margin",                    "value": "10"                },            ]        }    ]

Suggested objectData fields#

The objectData object is made up of key-value pairs that contain metadata about the event. In order to properly attribute conversions, you must include one of email (email), SHA-256 hashed email (emailsha256), or Rokt Tracking ID (passbackconversiontrackingid) in objectData so that Rokt can identify the customer.

For the conversion reporting use case, we recommend you include the following attributes.

Field nameDescriptionExample
emailEmail passed as plain text, lowercase and without trailing spacesjohn@email.com
emailsha256SHA256 hash of email address. Prior to hashing, lowercase and without trailing spaces.fab1e2e699b3b927cbf875046a64f222 5df02d5cb306f3857424c2bbb87be61f
passbackconversiontrackingidAlso known as Rokt Tracking ID. A Rokt-generated ID used to match conversion events to the originating click. Requires a separate integration.1bc29b36f623ba82aaf6724fd3b16718
amountValue of the transaction (allows decimal points)100.25
currencyCurrency codeUSD
quantityThe quantity (integer) of item within the specific conversion4
conversiontypeUsed to differentiate between different conversion events. Note: Only applicable if the default conversion event type is provided.ticketpurchase, seatupgrade signup
productnameThe name of the product(s) purchased. You can separate multiple items with a comma.Maroon 5 t-shirt, Warriors vs. Raptors
skuThe identifier of the product purchased (Note: Only accepts one SKU)230847, tshirt-blue-39487, 398fhdnff
paymenttypeThe payment method used during the transactionVISA, American Express
marginProfit margin of conversion10
transactionidTransaction ID, used to identify a unique transaction. Note: If provided, Rokt uses this identifier to deduplicate conversion events across channels.ABC789
confirmationrefConfirmation reference ID. Alternate identifier that may be used to identify a unique transaction and/or track order confirmations. Note: If provided, Rokt uses this identifier to deduplicate conversion events and transactionid is unavailable.XYZ123
firstnameCustomer's first nameJohn
lastnameCustomer's last nameSmith
mobileMobile phone number of converting customer3053211654, +1 (323) 867-5309
ipaddressCustomer's IP address172.3.51.182
Custom attributes#

Rokt has a data mapping system that allows us to map provided field names to our internal data fields, however we have some recommended field names and formatting requirements later in this article. If you would like to use alternate field names, let us know, and we will ensure your fields are managed accordingly. Additionally, we can accept any additional fields if you would like to provide them for reporting purposes.

Premium integration: Combining the Web SDK and Event API#

If possible, we recommend setting up conversion reporting through both the Web SDK and Event API. This helps identify any anomalies and provides redundancy if there are any issues on the frontend or backend.

If you choose to set up both integrations, ensure you populate one of transactionid or confirmationref in both the Web SDK and Event API integrations. Rokt can then deduplicate incoming your conversion events using these variables, ensuring your reporting is accurate.

Was this article helpful?