In Chameleon, buttons are powerful components. Aside from directing your product guidance, you can configure these for actions such as: redirecting to a different URL, firing a click on an element, launching a Microsurvey, and more.

👉 Read this article to learn how to leverage Additional actions.

How can buttons capture my users' responses?

You can use Chameleon buttons to update user data in your product's database, system, or within another tool you use. For example, you could track a user's response to a question or allow them to indicate they're ready to upgrade or opt-in. 

To update your user's permissions or indicate their confirmation within your tools, you can use the Run Custom Code button Action, and add a few lines of code that will tell your system to make the update.

Practical example

GDPR consent

If you are seeking to gain consent about emails, from users inside your product, and save that as a user property within Intercom, you would simply use the following code when configuring the Run Custom Code Action:

var userId = window.intercomSettings.user_id;
Intercom('update', {
  user_id: userId,
  toc_2029_consent_at: new Date()

This would update Intercom and add the user property toc_2029_consent_at  (with the value of the date) for a user whenever they click the button.  

You could also use a different property name (simply replace toc_2029_ consent_at ) or value.

Note: this assumes that Chameleon is installed on your page and you have a variable called user  in your system, with an id  and email (if you use other terms, then simply replace these in the code above).

You can use a variation of this code block, for any system you would like data sent to. Here are a couple more examples for Segment and Hubspot:


analytics.identify(analytics.user().id(), {
  toc_2029_consent_at: new Date()


    toc_2029_consent_at: new Date(),

What else can I do with Custom Code Actions?

When running the Custom Code as a button Action, you can pretty much do anything that's possible with running code. These are some of our ideas:

  • Changing where the user's cursor is placed

  • Showing an animation or a sequence of animations

  • Opening the file upload dialogue 

  • Changing the color scheme of your app

  • For fun, you could try alert("hello world!"); 

But get creative and use this option to gain holistic insight into your product. 😉

💡 You can read this article to learn what you can achieve with JavaScript code in Chameleon.

Discover more

Did this answer your question?