Embedding Convert
How to integrate conversion campaigns with your application or site
Step 1 — Embed the snippet
To get started with conversion campaigns you'll need to add the embed snippet to your application or website.
You can find the embed snippet in the Campaigns screen or in Settings → Convert.
Copy the snippet and insert it just before the closing </head>
tag in your
application or website.
Step 2 — Initialize Convert
Next, Convert needs to know the ID of the subscription from your connected subscription platform to identify each subscriber as they visit your website or use your application.
Once you've added the embed snippet, call the ProsperStack.convert.init()
method with the ID of the subscription from your platform to complete the
Convert initialization.
For example:
document.addEventListener("DOMContentLoaded", () => {
window.ProsperStack.convert.init({
subscription: {
platformId: "sub_H6X0WYrAzq2iGk",
},
});
});
Once the init()
method is called, ProsperStack will initialize your Convert
campaigns and begin displaying offers.
Specifying a campaign
You can specify the conversion campaign to initialize with the campaignId
property. For example:
document.addEventListener("DOMContentLoaded", () => {
window.ProsperStack.convert.init({
campaignId: "cmpn_HsCgNwZxBe3fR9qVXEaCbB7H",
subscription: {
platformId: "sub_H6X0WYrAzq2iGk",
},
});
});
If no campaignId
is specified, your default campaign will be used.
Sending custom properties
Custom properties allow you to attach custom data to your subscriber and subscription objects for more powerful targeting and segmentation.
You'll need to create custom properties in ProsperStack before storing values in them. Learn more about managing custom properties.
Specify custom properties to attach to either a subscriber
or subscription
with the properties
object. Use an object with the unique identifier of the
property as the key, for example:
{
number_of_contacts: 5800,
is_professional: true,
last_contacted: "2021-05-04",
preferred_name: "Johnny"
}
Here's an example of initializing Convert with custom properties:
window.ProsperStack.convert.init({
subscription: {
platformId: "sub_H6X0WYrAzq2iGk",
properties: {
is_professional: true,
num_contacts: 5800,
},
},
subscriber: {
properties: {
preferred_name: "Johnny",
},
},
});