The embed step is crucial to getting Cancellation Insights up and running.

You'll need a little bit of experience editing code to get this working. If you don't have access to the code in your product, or don't feel comfortable editing it, we suggest having a developer on your team take care of it.

It should only take a couple of minutes to do this step.


You'll want to copy the embed code shown in the setup page.

The UNIQUE_API_KEY part will automatically be filled in.

The SUBSCRIPTION_1_ID  part is what you'll need to dynamically pass in. This is the subscription oid as given by your specific provider. (e.g. Stripe, Recover, Braintree, etc.) Usually you would have this stored on your server, in a database. 

IMPORTANT: These are subscription ids NOT user ids. e.g. sub_{x} 

NOTE: We don't sync with provider (Stripe, Recover, etc.) test environments.
This means you'll need to use actual live subscription oids whenever you expect cancellation events to show up in the Cancellation Insights dashboard.

You pass this as an Array, as you can cancel multiple subscriptions at the same time.

This code should go right before the closing </body>  tag of the page where your current cancellation button is.


After you've got the embed code put it, you'll need to add an HTML ID of barecancel-trigger  to whatever button or link you want to trigger the form.

NOTE: Cancellation Insights does NOT actually cancel your customer's subscription. It simply inserts a form into the process and then sends the user on through to the link href or form action you're using on your end to actually cancel the subscription with your provider.

NOTE: If your cancellation process sets the customer to "cancel at period end", their cancellation will NOT show in Cancellation Insights
Only cancellations that occur at the time the form is submitted will be included in Cancellation Insights. 

Test your embed code

After you code your code embedded, you'll need to do one test cancellation. Don't worry, we'll intercept the very first call so it doesn't pass through to your actual cancellation.

Additional embed code options

For those needing a little extra customization we've got a few additional features. Specifically callback_send  and test_mode.


Triggered after the "Cancel Account" button is clicked. Useful for capturing the actual account cancellation event from your end if you're not utilizing a standard form element or a link redirect.

window.barecancel.params = {
  access_token_id: "ABC-123-ACCESS-TOKEN",
  subscription_oids: ["SUBSCRIPTION_1_ID", "SUBSCRIPTION_2_ID"],

  callback_send: function(data) {
    // Your own callback logic
    // e.g.
    axios.delete(`/api/users/${user_id}`, {
      reason: data.reasons.find((reason) => === data.selected_reason),
      comment: data.comment


Just fiddling around locally or on staging and don't want to clutter your Baremetrics dashboard with test cancellation events? We've got you!

window.barecancel.params = {
  access_token_id: "ABC-123-ACCESS-TOKEN",
  subscription_oids: ["SUBSCRIPTION_1_ID", "SUBSCRIPTION_2_ID"],

  test_mode: true


Just be sure and remove or toggle this boolean to false before pushing to production!


You can require the comment and optionally set the error message.

window.barecancel.params = {
  access_token_id: "ABC-123-ACCESS-TOKEN",
  subscription_oids: ["SUBSCRIPTION_1_ID", "SUBSCRIPTION_2_ID"],

  // Can be a Boolean or a String
  // In case of String we'll use that as the error message
  // If the comment is not set
  comment_required: true

Did this answer your question?