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 draft 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 | |
|---|---|
Authentication string required | Authentication bearer token See Sign up and authenticate |
X-IAA-OW-ID integer required | Organization Workspace ID Header |
Step 1: Log in
POSTTo log in, the Authentication: Basic header is required. The Login API returns an OAuth-compliant response with an Organization Workspace ID (owId), a unique identifier for each Organization. This ID is used for any further API communications.
For further information see OAuth token.
| Headers | |
|---|---|
Authentication string required | Authentication bearer token. See Sign up and authenticate |
| Request schema | |
|---|---|
grant_type string required | password for login 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 <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>'
{
"success": true,
"data":
{
"access_token": "106adb25-37b0-4cab-8381-d682fe7cc3c8",
"refresh_token": "eac4c1f6-781e-4b04-baff-9c2e415d1f64",
"scope": "read write",
"token_type": "bearer",
"expires_in": 35999,
"owId": 200001
}
}
More responses
{
"success": false,
"data":
{
"status": "On Hold",
"reason": "The particular account is kept on hold due to missed payment dates for last 3 months.",
"supportEmail": "support@iqm.com"
},
"errorObjects":
[
{
"error": "User is not allowed to access provided customer",
"reason": "User is not associated with any active organization."
}
]
}
{
"success": false,
"errorObjects":
[
{
"error": "User doesn't exist or user is not allowed to provided workspace."
}
]
}
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
statusId integer | Status ID. | |||||||||||||||||||||||
name string required | Name for Pixel conversion | |||||||||||||||||||||||
attributionId string required | Attribution type ID | |||||||||||||||||||||||
customFields string | 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 |
postbackPartnerName string | Postback partner name |
status string | Conversion status |
type string | Conversion type |
created integer | Unix epoch creation date, in milliseconds |
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 integer | Universally Unique Identifier |
pixelConversionScript string | Pixel conversion script |
attributedConversion integer | The number of conversions that are attributed to a specific campaign based on the Attribution model |
attributedViewThroughConversion integer | The number of conversions that occurred after a user viewed an ad but did not click on it |
attributedClickThroughConversion integer | The number of conversions that occurred after a user clicked on an ad |
pixelFinancialMetric string | Pixel financial metric |
postbackPartnerLogoUrl string | Postback partner logo URL |
- JSON
- TypeScript
{
"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": 3213,
"name": "PixelConversion",
"postbackPartnerName": null,
"status": "Pending",
"type": "Pixel",
"created": 1687459918,
"totalConversions": 0,
"owId": 202017,
"createdByUowId": 108658,
"modifiedByUowId": 108658,
"uuid": "a574ca49cc244c3bb3089491a11aae43",
"attributedConversions": 0,
"attributedViewThroughConversions": 0,
"attributedClickThroughConversions": 0,
"pixelFinancialMetric": "name",
"postbackPartnerLogoURL": null,
"pixelConversionScript": "<script src='https://pxl.stage.iqm.com/i/pixel/8f3165d0-b714-440e-bc1d-621127fa5fad?cv={CONVERSION_VALUE}' async></script>",
"partnerUrl": null
}
}
See TypeScript prerequisites for usage.
import {
getInstance
} from "prerequisites"
const axios = getInstance();
interface Responses {
200: {
content: {
"application/json": {
success: boolean;
data: {
id: number;
name: string;
postbackPartnerName: string;
status: string;
type: string;
created: number;
totalConversions: number;
owId: number;
createdByUowId: number;
modifiedByUowId: number;
uuid: string;
attributedConversions: number;
attributedViewThroughConversions: number;
attributedClickThroughConversions: number;
pixelFinancialMetric: null;
postbackPartnerLogoURL: string;
pixelConversionScript: string;
partnerUrl: string;
}
};
};
};
};
function addPixelConversion(): Promise<Responses> {
const options = {
method: 'POST',
url: 'https://api.iqm.com/api/v3/conversion/pixel/add',
requestBody: {
content: {
"application/json": {
id?: `number`,
name: `string`,
uuid?: `string`,
typeId?: `number`,
owId?: `number`,
createdByUowId?: `number`,
modifiedByUowId?: `number`,
statusId?: `number`,
status?: `string`,
created?: `number`,
attributionId?: `number`,
customFields?: `array of strings`,
financialMetrics?: `string`,
piggybackData?: {
url?: `string`,
type?: `number`,
},
pixelConversionScript?: `string`,
conversionSetting: {
conversionDuration: {
view?: `number`,
click?: `number`,
},
repeatConversion: {
count: `number`,
frequency: `number`,
unit: `string`,
},
crossModelling?: `boolean`,
}
}
}
}
};
return axios.request(options).then(({ data }: { data: Responses }) => data);
}
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.
| Query parameters | |
|---|---|
assignConversionToCampaign string optional | Map containing details list of campaign IDs which need to be added/removed |
| 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 integer | 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
- TypeScript
{
"conversionIdList": [
3925
],
"addCampaignsList": [
25396,
256374,
234567
],
"removeCampaignsList": [
256321,
256432,
256433
]
}
{
"success": true,
"data": {
"conversionIdsList": 3925,
"validAddCampaignIdsList": [
253396,
256374
],
"invalidAddCampaignIdsList": [
234567
],
"validRemoveCampaignIdsList": [
256321,
256432
],
"invalidRemoveCampaignIdsList": [
256433
]
}
}
See TypeScript prerequisites for usage.
import {
getInstance
} from "prerequisites"
const axios = getInstance();
interface Responses {
200: {
content: {
"application/json": {
success: boolean;
data: {
conversionIdsList: number;
validAddCampaignIdsList: number[];
validRemoveCampaignIdsList: number[];
invalidRemoveCampaignIdsList: number[]
}
}
};
};
};
function assignConversionToCampaign(): Promise<Responses> {
const options = {
method: 'POST',
url: 'https://api.iqm.com/api/v3/conversion/assign-to/campaign',
params: {
query: {
assignConversionToCampaign?: `string`
}
},
requestBody: {
content: {
"application/json": {
conversionIdList?: `array of numbers`,
addCampaignsList?: `array of numbers`,
removeCampaignsList?: `array of numbers`,
}
}
}
};
return axios.request(options).then(({ data }: { data: Responses }) => data);
}