Create a Conversion
IQM’s REST API enables you to interact with most of our platform's applications.
The following endpoints will be used to create a Conversion and assign it to a Campaign:
/api/v3/ua/login/api/v3/conversion/pixel/add
/api/v3/conversion/assign-to/campaign
About IQM Conversions
IQM uses Conversions as a tool to track user traffic for your Campaigns.
The IQM platform supports two types of Conversions:
- Pixel Conversions are client-side tracking and they feature advanced settings for fine-tuned optimization.
- Postback Conversions are server-side.
Learn more about Conversions with our Help Center articles.
Before You Begin
To upload Matched Audience, 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 Quickstart Guide will cover 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
Step 1: Log In
POST /api/v3/ua/loginTo log in, the Authentication: Basic header is required. The Login API returns an OAuth-compliant response with an Organization Workspace ID (owId), which is a unique identifier for each Organization. This ID will be used for any further API communications.
For further information see the complete Login API Documentation.
Headers | |
---|---|
Authentication string required | Authentication bearer token. See Authentication Guide |
X-IAA-HOST string required | Workspace URL |
Request Schema | |
---|---|
grantType string required | OAuth Grant Types |
email string required | User account email |
password string required | User account password |
- JSON
- TypeScript
{
"grantType": "password",
"email": "pratik.t+ihp@iqm.com",
"password": "123456"
}
{
"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."
}
]
}
See TypeScript Prerequisites page for usage.
import {
getInstance
} from "prerequisites"
const axios = getInstance();
interface Responses {
200: {
content: {
"application/json": {
success: boolean;
data: {
access_token: string;
refresh_token: string;
scope: string;
token_type: string;
expires_in: number;
owId: number;
};
};
};
};
400: {
content: {
"application/json": {
success: boolean;
data: {
status: string;
reason: string;
supportEmail: string;
};
errorObjects: {
error: string;
reason: string;
}[];
};
};
};
403: {
content: {
"application/json": {
success: boolean;
errorObjects: {
error: string;
}[];
};
};
};
};
function Login(): Promise < Responses > {
const options = {
method: 'POST',
url: 'https://app.iqm.com/api/v3/ua/login',
requestBody: {
content: {
"application/json": {
email: `string`,
password: `string`,
}
}
}
};
return axios.request(options).then(({ data }: { data: Responses }) => data);
}
Step 2: Create a Pixel Conversion
POST /api/v3/conversion/pixel/addCreate a pixel type Conversion. Refer to the Request Schema table below for supported and required properties.
Headers | |
---|---|
Authentication string required | Authentication bearer token See Authentication Guide |
X-IAA-OW-ID integer required | Organization Workspace ID Header |
Request Schema
statusId integer | Status ID | |||||||||||||||||||||||
name string required | Name for Pixel Conversion | |||||||||||||||||||||||
attributionId string | 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 optional | 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 required | 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://app.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
PATCH /api/v3/conversion/assign-to/campaignAssign 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.
The Campaign must be in "draft" status to assign a Conversion to it. Once a Campaign has been run, new Conversions cannot be assigned to it.
Headers | |
---|---|
Authentication string required | Authentication bearer token See Authentication Guide |
X-IAA-OW-ID integer required | Organization Workspace ID Header |
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://app.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);
}