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

Custom fields in JavaScript are used to send data that may not be available on the page for the Visual Editor to collect or update fields on events besides page loads.


Interaction Studio Classic Only

Please note, 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.

This Article Explains

This section details how to use custom fields in JavaScript to send data.

Sections in this Article

Sending Data on Page Load

  • The JavaScript must be listed before the beacon, generally after the declaration of userId in your integration.

    _aaq.push(['setCustomField',CUSTOM_FIELD_NAME,CUSTOM_FIELD_VALUE,'request']);
  • CUSTOM_FIELD_NAME <String>: The name of the field you would like to track.
  • CUSTOM_FIELD_VALUE: The value of the field you would like to track.
    Note: Field Names and values must be strings, booleans, integers or floats.
  • The final argument 'request' can be substituted for 'page'
    • Request: Field is sent to Interaction Studio only on page load.
    • Page: Field is sent with every action taking place on current page, including page load.
    See here for more details regarding JavaScript setup of the Beacon and sending data on page load.

Sending Data On Other Events

  • Fields can be sent at other moments besides page load in a similar fashion, with an extra line of code.

    _aaq.push(['setCustomField', CUSTOM_FIELD_NAME, CUSTOM_FIELD_VALUE, 'request']);
    _aaq.push(['trackAction', ACTION_NAME]);
  • CUSTOM_FIELD_NAME <String>: The name of the field you would like to track.
  • CUSTOM_FIELD_VALUE: The value of the field you would like to track.
    Note: Field Names and values must be strings, booleans, integers or floats.
  • The final argument 'request' can be substituted for 'page'
    • request: Field is sent to Interaction Studio only on page load.
    • page: Field is sent with every action taking place on current page, including page load.
  • ACTION_NAME <String>: Action to take place after setting field. Fields are only sent if an action takes place after setting the field.


A note about fields: After a field is passed to Interaction Studio for the first time it will not immediately appear as a user or account field. You must visit the 'Fields' section of the Settings within the Interaction Studio app and declare the field as such.