conversionloopdevelopers

Getting started

Conversionloop asks your visitors the right question at the right moment: an exit-intent survey on the checkout, a rating after the third product page, a follow-up for visitors from one campaign. This site covers the two things developers work with:

  • The script on your website. It decides in the browser which campaign to show, renders it and sends the answers back. You can pass it your own data, such as the cart value or the customer's plan, and target campaigns with it.
  • The REST API at https://api.conversionloop.net. Everything you set up in the dashboard, you can automate here: projects, data fields, audiences and campaigns. You can also read the results.

Install the script

Copy the script tag from the dashboard (Settings → Project) into the <head> of every page:

<script async src="https://cdn.conversionloop.net/v1/p/prj_live_xxxxxxxxxxxxxxxxxxxxxxxx.js"></script>

That's all you need for campaigns made in the dashboard. Install the script covers consent, allowed domains, single-page apps and Content Security Policy.

Make your first API request

  1. In the dashboard, open Settings → API tokens and create a token. Only workspace owners and admins can do this. Give the token only the scopes it needs, for example projects:read and campaigns:read.
  2. Copy the token. It starts with cl_sk_ and is shown only once.
  3. List your projects:
export CL_TOKEN=cl_sk_...

curl https://api.conversionloop.net/v1/projects \
  -H "Authorization: Bearer $CL_TOKEN"
{
  "data": [
    {
      "id": "prj_4k9x2m7q1v8b3n6c5z0wd",
      "name": "Online shop",
      "publicKey": "prj_live_0wk048ap7g5r9ba007fs98gj",
      "domains": ["shop.example.com"],
      "inlineConfig": true,
      "_count": { "campaigns": 3, "audiences": 2, "dataFields": 4 }
    }
  ]
}

The id (starting with prj_) is what you use in API paths. The publicKey belongs in the script tag and is not a secret.

  1. List the campaigns of that project:
curl https://api.conversionloop.net/v1/projects/prj_4k9x2m7q1v8b3n6c5z0wd/campaigns \
  -H "Authorization: Bearer $CL_TOKEN"

How the pieces fit together

Concept What it is
Workspace Your account. API tokens belong to one workspace and can reach all of its projects.
Project One website: one script tag, one public key.
Data field A typed value your page passes to the script, e.g. cart_value.
Audience A reusable segment: conditions on behaviour, page, device or your data fields.
Campaign A question shown to an audience. Starts as a draft and goes live through its status.

Next steps