Create a conversion
Create a conversion with this in-depth tutorial using IQM's API.
The following endpoints are used to create a conversion and assign it to a campaign:
POSTPOST
POST
About IQM conversions
IQM uses conversions as a tool to track user traffic for your campaigns.
The IQM platform supports three types of conversions:
- Pixel conversions are client-side tracking and they feature advanced settings for fine-tuned optimization.
- Postback conversions use server-to-server tracking, sending conversion data directly from your server to IQM without relying on browser-based JavaScript or cookies.
- Universal Pixel conversions are client-side and use a single JavaScript snippet that can track multiple conversion events across your site without deploying separate per-page pixels.
More resources
- Conversions and tracking Help Center article
- Conversions API guidelines
Before you begin
To create a conversion, the following are required:
- An account on the IQM platform
- See Getting started section to create an account and request a Client ID and Client Secret
- A campaign that isn't running yet, such as a draft campaign
- See Create a campaign, or create a draft with POST /api/v2/cmp/campaigns/draft/add (see Create new campaign)
Create a conversion using the IQM API
This tutorial covers how to create a conversion and assign it to a campaign.
The minimum requirements to perform this task are: logging in with authentication credentials, creating a conversion, and assigning it to a campaign. Once these steps are accomplished, more can be learned about IQM's API through the guidelines pages.
- Log in
- Optional if you have already logged in and have a token
- Create a conversion
- Assign conversion to a campaign
Authentication
Use the following header parameters for all requests after logging in:
| Headers | |
|---|---|
Authorization string required | Bearer followed by the access_token from the login response. See Sign up and authenticate. |
X-IAA-OW-ID integer required | Organization Workspace ID header. |
Step 1: Log in
POSTTo log in, send the Authorization: Basic header with your Base64-encoded Client ID and Client Secret, and send the request body as form data (application/x-www-form-urlencoded). The response contains an OAuth access token.
To find the Organization Workspace IDs that you have access to, use Get list of accessible Organizations.
For further information see OAuth token.
| Headers | |
|---|---|
Authorization string required | Basic followed by your Base64-encoded client_id:client_secret. See Sign up and authenticate. |
Content-Type string required | application/x-www-form-urlencoded. Send the request body as form data. |
| Request schema | |
|---|---|
grant_type string required | password for login. See OAuth Grant Types. |
username string required | User account email. |
password string required | User account password. |
- JSON
curl -i --location 'https://api.iqm.com/api/v3/ua/oauth/token' \
--header 'accept: application/json, text/plain, */*' \
--header 'Authorization: Basic <base64 of client_id:client_secret>' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=password' \
--data-urlencode 'username=user@iqm.com' \
--data-urlencode 'password=<your password>'
{
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIn0...",
"refresh_token": "eyJhbGciOiJIUzUxMiIsInR5cCIgOiAiSldUIn0...",
"scope": "read write",
"token_type": "bearer",
"expires_in": 86399
}
More responses
{
"success": false,
"errorObjects": [
{
"error": "Bad Credentials or invalid grant type"
}
]
}
{
"error": "Client details are not provided."
}
Step 2: Create a Pixel conversion
POSTCreate a Pixel type conversion. Refer to the Request schema table below for supported and required properties.
Request schema
name string required | Name for Pixel conversion. | |||||||||||||||||||||||
attributionId integer required | Attribution type ID. | |||||||||||||||||||||||
customFields array of strings | Allows user to pass additional data along with conversion details, which can be used for more detailed Insights. | |||||||||||||||||||||||
financialMetrics string | Allows user to pass additional financial data along with conversion details, which can then be used to calculate ROAs. | |||||||||||||||||||||||
piggybackData object | Piggyback data details. | |||||||||||||||||||||||
| ||||||||||||||||||||||||
url string | Additional URL that can be added to a Pixel conversion to send conversion information to a third-party platform. |
type integer | Piggyback type ID. |
pixelConversionScript string
conversionSetting object required
conversionSetting object properties
conversionDuration object required | Determines the length of time after a user clicks or views (or both: hybrid) an ad that a conversion can be attributed to that ad. | |||||||
| ||||||||
view integer | View-based attribution gives credit to an ad that a user saw, but did not necessarily interact with, before making a conversion Post view interval, days: [1...30]. |
click integer | Click-based attribution assigns credit for a conversion to the last ad that a user clicked on before making a purchase or taking an action Post click interval, days: [7...60]. |
repeatConversion object required
repeatConversion object properties
count integer required | Counts all conversions per user [0] or just 1 conversion per user [1]. |
frequency integer | Counts 1 conversion per user for specified number based on selected unit. |
unit string required | Selected unit of conversion frequency. |
crossModelling boolean optional
Response properties
id integer | Conversion ID. |
name string | Conversion name. |
status string | Conversion status. Always Pending for a new conversion. |
type string | Conversion type. |
created integer | Unix epoch creation date, in seconds. |
totalConversions integer | Total conversions count. |
owId integer | Organization Workspace ID. |
createdByUowId integer | Created by User Organization Workspace ID. |
modifiedByUowId integer | Modified by User Organization Workspace ID. |
uuid string | Universally unique identifier of the conversion. Also used in the pixel script URL. |
pixelConversionScript string | Pixel conversion script to place on the conversion page. |
pixelFinancialMetric string | Custom field used as the financial metric (from financialMetrics). Not returned if none was set. |
attributedConversions integer | The number of conversions that are attributed to a specific campaign based on the Attribution model. |
attributedViewThroughConversions integer | The number of conversions that occurred after a user viewed an ad but did not click on it. |
attributedClickThroughConversions integer | The number of conversions that occurred after a user clicked on an ad. |
campaignCount integer | Number of campaigns the conversion is assigned to. |
aiBasedConversion boolean | Indicates if the conversion is AI-based. |
- JSON
{
"name": "PixelConversion",
"attributionId": 1,
"customFields": [
"field_1",
"field_2",
"field_3"
],
"financialMetrics": "field_4",
"piggybackData": {
"url": "http://piggybackdata.com/url",
"type": 1
},
"conversionSetting": {
"conversionDuration": {
"view": 10,
"click": 10
},
"repeatConversion": {
"count": 1,
"frequency": 1,
"unit": "Day"
},
"crossModelling": true
}
}
{
"success": true,
"data": {
"id": 8073,
"name": "PixelConversion",
"status": "Pending",
"type": "Pixel",
"created": 1793036563,
"totalConversions": 0,
"owId": 204851,
"createdByUowId": 291477,
"modifiedByUowId": 291477,
"uuid": "63485822-6fb3-43ad-aad3-68a40c9a8001",
"pixelConversionScript": "<script src='https://iqm.com/d/c/conversion/63485822-6fb3-43ad-aad3-68a40c9a8001?cf1={FIELD_1}&cf2={FIELD_2}&cf3={FIELD_3}&cv={FIELD_4}' async></script>",
"pixelFinancialMetric": "field_4",
"attributedConversions": 0,
"attributedViewThroughConversions": 0,
"attributedClickThroughConversions": 0,
"campaignCount": 0,
"aiBasedConversion": false
}
}
Step 3: Assign a conversion to a campaign
POSTAssign a conversion to a campaign while validating conversion IDs and campaign IDs.
Pass the conversion id created in Step 2 in the conversionIdList array along with the campaign ID in the addCampaignsList array to assign the created conversion to the desired campaign.
Conversions can be assigned, updated, or removed from a campaign only before the campaign is running.
| Request schema | |
|---|---|
conversionIdList array of integers | Conversion IDs to assign. |
addCampaignsList array of integers | Campaign IDs to assign conversions to. |
removeCampaignsList array of integers | Campaign IDs to remove assigned conversions from. |
Response properties
conversionIdsList array of integers | Conversion IDs assigned to campaigns. |
validAddCampaignIdsList array of integers | Validated campaign IDs to assign a conversion to. |
invalidAddCampaignIdsList array of integers | Invalid campaign IDs to assign a conversion to. |
validRemoveCampaignIdsList array of integers | Validated campaign IDs to remove a conversion from. |
invalidRemoveCampaignIdsList array of integers | Invalid campaign IDs to remove a conversion from. |
- JSON
{
"conversionIdList": [
8073
],
"addCampaignsList": [
625977,
999999999
],
"removeCampaignsList": []
}
{
"success": true,
"data": {
"conversionIdsList": [
8073
],
"validAddCampaignIdsList": [
625977
],
"invalidAddCampaignIdsList": [
999999999
],
"validRemoveCampaignIdsList": [],
"invalidRemoveCampaignIdsList": []
}
}