Chameleon allows you the flexibility to build your own custom integrations using JavaScript. You can get an overview of this integration by visiting our integrations webpage.

There are two components to this:

  • Using the JS API to send data to Chameleon, trigger Experiences, and tracking events.

  • Running JS code from any Chameleon Experience to create custom functionality.

The possibilities this opens are unlimited. For example, you could cause a Chameleon button to add focus to a specific input field in your app, can help your users take action in the right place to discover the value you are trying to demonstrate.

Using the JS API

You can use our JS API to send user properties, track events, trigger Chameleon Experiences, and more.

This gives you the flexibility to incorporate Chameleon into key flows of your user journey, by making API calls either from your app or any other software on your stack.

One interesting use case could be, for example, to track an event every time a user opens a premium feature on your app, and then use this event to target these users for upsells. The API call would look like this: chmln.track("Visited A/B Testing landing page");.

👉 Visit our Developer Hub to know everything about our APIs

Running JS code from Chameleon Experiences

Chameleon allows you to run custom JavaScript code from a button within any Experience or from a Launcher Item.

There are many examples of what you could execute, including:

  • Scrolling/focusing a user to a different place/element on the page.

  • Submitting some data to your systems (e.g. interest in a feature).

  • Opening up another in-product service (e.g. Zendesk chat window).

  • Giving a user a delightful surprise.

As mentioned before, you can run custom code from a Chameleon Button or from a Launcher Item; and both cases are equally easy to set up.

Triggering JS code from a Chameleon Button

To run code from a button, you'll need to leverage button actions. When the action is defined, the piece of code included will be run as soon as the button is clicked.

Triggering JS code from a Launcher Item

To run JavaScript code from a Launcher, you can use the Script Launcher Item -- similarly, the code in the JS code box will be run as soon as your users click the Launcher item.

What code should I run?

Any developer familiar with your product can help you write simple JavaScript or JQuery functions to add to the button. For fun and test how this feature works, you can try running alert("hello world!"); .

We have also written an article dedicated to showcasing common use cases for this feature, containing code examples.

Note: If you employ a Content Security Policy (CSP) then you must add an exception to allow this functionality to be used.

More integrations

Did this answer your question?