Page tree
Skip to end of metadata
Go to start of metadata

Interaction Studio (formerly Evergage Classic) can accept optional data from your back-end system or site. These fields will need to be pushed into Interaction Studio and may require an engineer or developer resource to write a JavaScript function to access the appropriate data and store it as a variable. 


Interaction Studio Classic Only

  • The contents of this article are intended for customers using Interaction Studio (formerly Evergage Classic). Do not adjust your beacon version to downgrade or upgrade.
  • The Visual Editor Chrome Extension will no longer be available starting January 1, 2023. For more information, see this knowledge article.
This Article Explains

This article details the fields and functions related to the JavaScript Beacon.

Sections in this Article

Introduction

Interaction Studio can accept optional data from your backend system or site. These fields will need to be pushed into Interaction Studio and may require an engineer or developer resource to write a JavaScript function to access the appropriate data and store it as a variable. 

All of the functions in this document rely on being pushed to our "_aaq" array in the following format:

_aaq Function
_aaq.push(['functionName','argument1','argument2',...]);

NOTE

Custom fields and user/account names can often be captured using the Visual Editor. For additional information, please visit the article How to Install the JavaScript Beacon.

Track User and Account Data

Data can be passed into Interaction Studio by adding the line of code listed below into the JavaScript beacon, or site wide JavaScript.

Encrypted User ID

If you are enabling message security (recommended if messages will contain private data), you must pass the Encrypted User ID to Interaction Studio.

_aaq.push(['setEncryptedUser', SET_TO_THE_ENCRYPTED_USER_ID]);

User ID

Used to tell Interaction Studio who the current user is. You must pass either the User ID or Encrypted User ID to Interaction Studio in order to successfully track events.

_aaq.push(['setUser', SET_TO_CURRENT_USER]);

Company/Account

Used to tell Interaction Studio the account associated with the current user. Typically, it is necessary for B2B companies to send this value, but often not necessary for B2C companies. Although Interaction Studio will still track data, without this code added to the beacon or sitewide JavaScript code, all users will be grouped in the Anonymous account.

_aaq.push(['setCompany', SET_TO_COMPANY]);

Account Status

Used to set the customer's lifecycle or subscription type (e.g. free trial, freemium, paid-basic, paid-premium) 

_aaq.push(['setAccountType', SET_TO_SUBSCRIPTION_LEVEL]);

User Display Name

Used to set the user's display name in Interaction Studio. By default the User Display Name will appear alongside the UserID on the dashboard. Use Search to find a specific value.

_aaq.push(['setCustomField', 'userName', SET_TO_USER_DISPLAY_NAME, 'request']);

User Email

Sets the user's email address in Interaction Studio. If you're not passing the email as the UserID but still have access to this data, you can pass it separately.

_aaq.push(['setCustomField', 'userEmail', SET_TO_USER_EMAIL, 'request']);

Account Display Name

Similar to the User Display Name, the Account Display Name will appear alongside Company/Account on the dashboard. Use Search to find a specific value.

_aaq.push(['setCustomField', 'accountName', SET_TO_ACCOUNT_DISPLAY_NAME, 'request']);

Other Custom Fields

Used to pass custom fields to Interaction Studio, such as demographic data, user role, or any other numeric or text data.

NOTE

Attributes are not set in Interaction Studio if the attributes do not already exist in Interaction Studio. To create a new attribute in Interaction Studio, log in as an administrator and select SETTINGS > Attributes > New Attribute. Once the attributes are created, they will appear in Interaction Studio from that point forward.

The context argument can be one of the following case sensitive calls:

  • request: sends the custom attribute once. Interaction Studio recommends using this call to pass custom fields
  • page: sends the custom attribute every time a viewer performs an action on the page
  • visit: sends the custom attribute with every action on any page for the remainder of the visit. A visit is defined in Interaction Studio as lasting as long as the visitor keeps performing actions without a 30-minute gap


Request Example
_aaq.push(['setCustomField', CUSTOM_FIELD_NAME, CUSTOM_FIELD_VALUE, 'request']);


To implement, first replace the capitalized words with the appropriate variable (strings, booleans, integers, or floats only)

Request
_aaq.push(['setCustomField', 'host', window.location.hostname, 'request']);


Then, add the following after the variable "_aaq" has been established:

Track Action
if (window._aaq) {
    _aaq.push(['trackAction', SET_ACTION]);
}

Track Data Using On-Page Actions

The above JavaScript commands can also be used within on-page events, such as on-click and on-submit. The track action call is only needed at the end, not after every field. The track action call is only needed for on-click and other on-page elements, not when customizing the JavaScript Beacon.

This line will track actions within Interaction Studio, like an on-click action of a link. However, Interaction Studio will only receive data when an action occurs. For example, after using the setCustomField command, add a track action call after it so Interaction Studio captures the data.

_aaq.push(['trackAction', SET_ACTION]);


Example of an on-click event passing a custom field and action:

onclick="_aaq.push(['setCustomField', 'guidedtour', 'no', 'request']);_aaq.push(['trackAction','tour']);"

Clear User and Account Data from Your Cookie

By default Interaction Studio will record your userId and your accountId on your cookie. If at any point you would like to clear this data you can remove all user data associated with this cookie by calling the function:

_aaq.push(['clearUser']);

You can also clear your current account information with:

_aaq.push(['clearCompany']);

Please note that the clearUser() function will also call clearCompany() to completely disassociate all user data.