Deploying with our API

Est. implementation time: ⏰ 10 minutes

To integrate Coframe into your website, mobile app, or other application programmatically, follow the steps below.

You can also play around with the API in our API playground.

  1. Create a coframe as described above.

  2. Create an API key on the Account page and include this in the X-API-KEY header of the following GET request. It is not required for the POST request as a session_id is required for it.

  3. GET variant (API Reference)
    Make a GET request to the following URL, which is copyable on your coframe page: https://coframe.ai/api/v1/retrieve_variant_coframe?coframe_id={{coframe_id}}&session={{true/false}}

  • If session = true, we will log this as an impression and return a session_id which you'll need for the following POST request and the response will look like this:
{
   "variant_data": {
      "coframe_page_id": string,
      "original": string,
      "variant_id": string,
      "variant": string
   },
   "session_id": string
}

Apply variant_data.variant to your application where needed. Save the session_id.

  • If session = false, we will not log this as an impression and the response will look like this:
{
   "variant_data": {
      "coframe_page_id": string,
      "original": string,
      "variant_id": string,
      "variant": string
   }
}

Apply variant_data.variant to your application where needed.

  1. POST session result (API Reference)
    Make a POST request tohttps://coframe.ai/api/v1/session_result with the body being:
{
   "session_id":string,
   "engagement":boolean (optional),
   "conversion":boolean (optional),
   "bounced":boolean (optional)
}

Set engagement = true if the user engaged (spent more than 10 seconds, as per the Google Analytics standard for engagement). Set conversion = true if the user converted based on your app's logic. Set bounced = true if the user bounced.

Screenshot of the dashboard where you can find the necessary endpoints for incorporating Coframe using the API.

Screenshot of the dashboard where you can find the necessary endpoints for incorporating Coframe using the API.