All Collections
Integrations & Data Management
Custom integrations
Creating custom integrations using JavaScript
Creating custom integrations using JavaScript

Learn how to use JavaScript to integrate Chameleon with other products from your tech stack

Tiago Mota avatar
Written by Tiago Mota
Updated over a week ago

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 page.

There are two ways you can use JavaScript:

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

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

The possibilities this opens are unlimited. For example, you could set a Chameleon button to add focus to a specific input field in your app. πŸ‘‡ This way you help users take action in the right place to discover the value you are trying to demonstrate.

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");.

Chameleon allows you to run easily 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.

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 a user clicks the button.

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.

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!"); . πŸ˜‰

You can also check out this article dedicated to showcasing common use cases for this feature, including 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?