Pricing
Go to app
User Name
E-mail
Upgrade Help Center

Configure custom variables

Wojciech Guminski
5 min read
updated: Nov 15, 2023

Having a set of information on your customer at the beginning of a chat is valuable for every live chat agent. With such details, each chat can be handled faster and more efficiently.

Setters can aid you in achieving this effect. They can be used to pass important visitor information at the beginning of every chat. You can pull names, e-mails, addresses of your visitors from your CRMs to provide context to each conversation.

Additionally, you can create custom invitations that are based on data you pass to LiveChat. For example, you could create an invitation targeting visitors who make mistakes in your forms or one that would refer to the items in the shopping cart of a particular visitor.

This article will show you example implementations with ready to use code snippets. There is a lot of place for creativity. Try finding your own unique ways to use setters. Just remember to implement them on pages where LiveChat installation code is present in their files.

CRM data grabbingLink icon

If you have a CRM solution or a customer database, you can display data like name, e-mail, etc. directly in the chat window. You don’t have to stop at personal data. You can pass any kind of information that will help you service the client better.

To add such setters, you need to implement the following example code in your website’s files:

<script>
LiveChatWidget.call("set_session_variables", {
  Login: "joe_public",
  Account_ID: "ABCD1234",
  Total_order_value: "$123",
});
</script>

Next, you can customize the setters to pass the exact data you need to chats. Set them up just like the Login, Account ID and Total order value setters in the example code.

You need to have the same kind of variables set up in your backend, to populate setters correctly.

Make sure you don’t show any sensitive data in your setters since it is visible in your tracking code.
Make sure you don’t show any sensitive data in your setters since it is visible in your tracking code.

When you finish the setup, you will be able to recognize your customers, grab their data from your database or CRM and show that information in your chat window.

No more form mistakesLink icon

If you have a form on your website, you can use our setters to send out a campaign whenever a visitor makes a mistake in the said form.

To set this up, you need to add a setter that would check if the form is filled out correctly or not. An example code can be found below:

<script>
LiveChatWidget.call("set_session_variables", {
  survey_error: "1",
});
</script>

You need to have the same kind of variables set up in your backend.

Next, you need to create a campaign for this variable.

  1. Go to Engage > <a href=“https://my.livechatinc.com/engage/campaigns/recurring"_blank">Campaigns and click on New campaign.

  2. Set your campaign looks and select Next: set conditions.

  3. Next, select Custom variable as the campaign condition.

  4. Enter the campaign message, the variable name and its value.

Add a campaign triggered by a custom variable in LC

  1. Finish by clicking on Save campaign.

Now, every time your visitor incorrectly fills out a survey, he or she will receive an instant help offer from one of your representatives.

Setters are also stored in your chat history. You can see them right under the pre-chat survey data in the Archives section.
Setters are also stored in your chat history. You can see them right under the pre-chat survey data in the Archives section.

Tailored invitationsLink icon

If you have a shopping cart on your site, you can send out tailored invitations to your shoppers.

To achieve this, you need to add a setter in your website’s files that would relate to the contents of the shopping cart. Here’s an example of such a setter:

<script>
LiveChatWidget.call("set_session_variables", {
    cart: "chairs",
    cart: "tables",
});
</script>

You need to have the same kind of variables set up in your backend.

Afterwards, you need to set up a custom campaign for these variables in the LiveChat Agent app, in the <a href=“https://my.livechatinc.com/engage/campaigns/recurring"_blank">**Campaigns** section.

  1. Select New campaign and set your campaign looks. Proceed by selecting Next: set conditions.
  2. Select the Custom variable as the campaign condition, enter the variable name and the desired value.
  3. Finalize by selecting Save campaign.
Your 1. campaign text should reflect the type of products placed in the shopping cart for the best results.
Your 1. campaign text should reflect the type of products placed in the shopping cart for the best results.

Tracking your campaigns’ conversionLink icon

Combine your chat link with setters and engage your customers with an additional channel of communication, allowing you to easily track your campaigns’ conversion! All of that with just a few easy steps.

  1. First, decide which parameters would you like to add to your link. If there’s a specific campaign that you’d like to track, you can include it’s name in your link, just like this:

    campaign=Winter Sale

  2. When adding Custom Parameters, keep in mind that you have to encode them with the UTF-8 standard. Remember the example above? Here’s how it’ll look like after encoding it with UTF-8:

    campaign%3DWinter%20Sale

  3. Once you encoded the parameter, remember to add all of them at the end of your link, right after the ?params= phrase. And here’s an example of how a full chat link with encoded parameters should look like:

    https://secure.livechatinc.com/licence/123456/open_chat.cgi?params=campaign%3DWinter%20Sale

To include multiple parameters in your chat link, simply put %26 between them and add them to your link.
To include multiple parameters in your chat link, simply put %26 between them and add them to your link.

Now you can start including the link in your campaigns and Export data to measure how many leads you have gained!

What’s next?Link icon

When it comes to the use of setters, this is just the tip of the iceberg. Apart from the listed examples, you can also use them in the following way:

  • Invite to chat customers who have reached a certain cart value, notifying you of bigger customers
  • Invite to chat only those who are logged in, when you have a portion of your service only for registered users
  • If your visitors login to your service, and you need to login to their control panel for support reasons, you can use setters to place a link to the said control panel
  • You can store tracking data from the LiveChat application using setters, the data is later available in the Archives section of your Control panel

Interested? Here you’ll find full documentation.

Was this article helpful?

Got it!

Thanks for your feedback.

Thank you!

We’re happy to help.

RELATED ARTICLES

Set up and use goals

Measure your live chat's effectiveness with goals. See how many chats end with the desired effect, for example, a chat closing with a sale!

Read the article

LiveChat for multiple websites

Learn how to install LiveChat on multiple domains. Share the same chat window look and behaviour across multiple domains or customize it per each site.

Read the article

Start using LiveChat now!

Free 14-day trial Team plan features No credit card required

Still not convinced? Discover all LiveChat features

Discover text| products: