Buttons within Chameleon tour steps are powerful! You can configure these for actions such as: redirecting to a different URL, firing a click on an element, opening the Intercom Messenger and launching the Typeform survey. 

For more information on how to leverage buttons please read this.

Updating user data

Buttons can also be used 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, it's as simple as selecting the 'Run code' button action (see below) and adding a few lines of code that will tell your system to make the update. 

Note this option is only available on certain custom plans -- please email us if you'd like access to this functionality. 

GDPR Example

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 code' action:

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

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

You could instead use a different property name (simply replace toc_2018_ consent_at ) or value.

Note: this assumes the following:

  • Chameleon is installed on your page
  • 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)

If you're unsure, check with your developer and they should be able to easily help 🤓

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_2018_consent_at: new Date()


    id: user.id
    toc_2018_consent_at: new Date(),

Other ideas

When running custom code from this button action, you can pretty much do anything that's possible by running code. Some examples include:

  • Changing where the user's cursor is placed
  • Showing an animation or other sequence of animations
  • Opening the file upload dialogue 
  • Changing the color scheme of your app
  • For fun, you could try alert("hello world!"); 

Once you have added your code, please toggle PREVIEW MODE on and click the button to test and sample how this code executes. 

To learn more about what else you can do with custom JS, check out our user guide here.

If you have any questions or issues please review how to best get help

Did this answer your question?