Skip to main content
Updating users' responses from a button

A button within a Step can do a lot, including updating your system with the user's response

Chameleon Team avatar
Written by Chameleon Team
Updated over a week ago

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

👉 Read this article to learn more about configuring buttons in Chameleon.


Availability & Usage

🔐 Available for all plans

📍 Ready to use in Tours, Tooltips, Microsurveys

⚙️ Configure from Media & Buttons


Quick access


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 additional Actions to:

  • Run Custom Code and add a few lines of code that will tell your system to make the update.

  • Update the property for every user who clicks your button in Chameleon, and leverage it via other Experiences, or export your data.

additional Actions options available from the Builder - Run custom code and update property

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:

Segment

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

Hubspot

_hsq.push(["identify",{
    id: user.id
    toc_2029_consent_at: new Date(),
}]);


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?