Passing Custom Data

Summary

There are two distinct methods for passing data into the ActivEngage platform. First you can pass it while calling methods on the JS SDK or you can include data attributes in the page markup. Both methods use a JSON object structure. This structure is broken up into two categories, chat-data and visit-data.

Chat Data

Chat data is data that is designed to provide context typically this information pertains to the type of vehicle this customer is currently viewing.

{
    launchSource: "customButton",
    vehicleStatus: "New",
    vehicleMake: "Toyota",
    vehicleModel: "Camry",
    vehicleYear: "2017",
    vehicleVin: "WAUC8AFC0HN089433"
}
1
2
3
4
5
6
7
8

Visit Data

Visit data is data that is designed to provide specific information about the visitor such as name, email, phone, etc. This data is typically pulled directly into the form. Visit data is often commonly used as an integration point. If there's specific information that we've worked with you on passing through this is the most likely place it will go.

{
    zipcode: "32751",
    firstName: "Andrew",
    lastName: "Smith",
    emailAddress: "technology@activengage.com",
    phoneNumber: "555-555-5555"
}
1
2
3
4
5
6
7

Passing Data On Click

The data described above can be passed before action is taken or it can be passed at the time the action is taken (ie when launchChat or launchSMS is called).

Passing Minimal Information

Its considered a best practice to pass in a launch source when calling the launchChat or launchSms methods. This helps support performance tracking for CTAs.

ActivEngage.launchChat({
    data: {
        launchSource: "customButton"
    }
});
1
2
3
4
5

Passing Vehicle Information Example

If you have specific vehicle data available you can include that when launching the chat.

ActivEngage.launchChat({
    data: {
        launchSource: "customButton",
        vehicleStatus: "New",
        vehicleMake: "Toyota",
        vehicleModel: "Camry",
        vehicleYear: "2017",
        vehicleVin: "WAUC8AFC0HN089433"
    }
});

1
2
3
4
5
6
7
8
9
10
11

Passing Customer Information Example

If you have specific customer information you can include that in a separate object.

ActivEngage.launchChat({
    data: {
        launchSource: "customButton"
    },
    visitData: {
        zipcode: "32751",
        firstName: "Andrew",
        lastName: "Smith",
        emailAddress: "technology@activengage.com",
        phoneNumber: "555-555-5555"
    }
});

1
2
3
4
5
6
7
8
9
10
11
12
13

Passing Data Using Data Attributes

Typically data attributes are used in cases where the website provider is using the ActivEngage provided CTAs. There are two attributes you use when passing in data with attributes and they correspond to our two categories of data, chat-data and chat-visitdata. Both attributes expect a JSON structure similar to what you see above.

Data attributes should be placed on the body of the page to impact all the CTAs present. If on the other hand you are showing multiple vehicles on a page and each one has a CTA then the data attribute should be placed on the CTA's parent element so that each CTA can receive the information specific to it.

You can view a live example of this at: https://markup-data-attributes.activengage.repl.co

Passing Minimal Information

Unlike the JS SDK there's no minimal data recommendation for passing data using the attributes. The launch source is not necessary here since the script it self will be providing the CTAs. The example below is provided to demonstrate that no fields are requried, its better to simply not provide the properties if the data is not available.

<body chat-visitdata='{"zipcode":"32806"}'>
1

Passing Vehicle Information Example

If you have specific vehicle data available you can include that in the chat-data attribute.

<body chat-data='{"vehicleStatus": "New", "vehicleMake": "Toyota", "vehicleModel": "Camry", "vehicleYear": "2017", "vehicleVin": "WAUC8AFC0HN089433" }'>

1
2

Passing Customer Information Example

If you have specific customer information you can include that in the visitdata attribute

<body chat-visitdata='{"zipcode": "32751", "firstName": "Andrew", "lastName": "Smith", "emailAddress": "technology@activengage.com", "phoneNumber": "555-555-5555" }'>

1
2

Passing Data Using JS SDK

An alternative to using attributes is the data section of the SDK. Both chat data and visit data can be passed in this manner. Using the data methods is ideal in cases where the WSP is using a SPA design. As with attributes you can pass as much data as you have available. The examples below show all data options but are not necessary.

Setting chat data

ActivEngage.data.setChatData({
        vehicleStatus: "New",
        vehicleMake: "Toyota",
        vehicleModel: "Camry",
        vehicleYear: "2017",
        vehicleVin: "WAUC8AFC0HN089433"
});

1
2
3
4
5
6
7
8

Setting visit data

ActivEngage.data.setVisitData({
        zipcode: "32751",
        firstName: "Andrew",
        lastName: "Smith",
        emailAddress: "technology@activengage.com",
        phoneNumber: "555-555-5555"
});

1
2
3
4
5
6
7
8

Note: There are a couple things to note when using these methods.

  1. This data is not stored and will need to be resupplied upon page navigation.
  2. If using a SPA design it would be considered best practice to update these methods with blank objects if the visitor moves to a page where the previous data is no longer relevant. This will prevent incorrect information from being passed in.
Last Updated: 10/14/2025, 2:20:10 PM