Full API List

All initialization settings and functions for Metalitix are listed below.

The example code below illustrates how to instantiate Metalitix with additional settings and call its functions.

<a-scene
     id="aframe-scene"
     metalitix-logger="
          apiKey: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx;
          sceneId: my-scene;
          surveyMinInterval: 5;
          surveyMaxInterval: 60;
">
     ...
</a-scene>
const { logger } = document.querySelector('#aframe-scene').components['metalitix-logger']

logger.clearAttributes()

logger.addInactivityListener(() => {
  console.log('Session has become inactive.')
})

Initialization Settings

SettingDefault

autoStartSession Whether to automatically call startSession() when the a-scene loads.

true

clientIPAddress The String IP address of the session used only to determine the session’s country. By default, the server automatically obtains an anonymized IP address (x.x.x.0) to calculate the country. IP address is never saved.

undefined (Automatically Calculated)

inactivityInterval The time, in seconds, before a session is automatically ended due to inactivity.

120

showSurvey Whether to randomly and automatically prompt the user for their sentiment during a session.

true

surveyLogo The String path or URL to the logo asset to use on the survey prompt.

undefined (Metalitix Logo)

surveyMaxInterval The latest time, in seconds, after session start when the survey might appear.

180

surveyMinInterval The earliest time, in seconds, after session start when the survey might appear.

30

DEPRECATED surveyTheme The styling of the automatic survey. Either white or black.

'white'

Functions

FunctionParametersReturns

addAnimation() Record the state of a scene's baked animation to Metalitix. The scene model uploaded to Metalitix must have an animation track of the same name.

AnimationAction animation - The animation track to record.

None

addInactivityListener() Adds a callback when a session is automatically stopped due to inactivity.

function callback - The function to run when a session becomes inactive.

None

clearAttribute() Resets the attribute value recorded by this session to the respective chart.

String chart - The name of the chart that session attribute is recorded to.

None

clearAttributes() Resets all attribute values recorded by this session to any charts.

None

None

clearAnimations() Remove all scene baked animation tracks from being recorded to Metalitix.

None

None

clearInactivityListeners() Removes all inactivity callbacks set by the user.

None

None

endSession() Stop sending data, close the session, and clear any session attributes (custom metrics).

boolean clearAttributes = true (Optional) - Whether to clear any session attributes.

None

isRunning() Checks whether the session is actively sending data.

None

true - The session is actively recording and sending data. false - The session is not recording or sending data because it has paused or ended.

logEvent() Best for representing user-generated actions. These will also appear in the Sessions tab.

String chart - The name of the chart to record to. String value The value to record to the chart (string only).

None

logState() Best for recording and monitoring general updates to sessions. These are similar to events but do not appear in the Sessions tab.

String chart - The name of the chart to record to. String|boolean|int value The value to record to the chart.

None

pauseSession() Stop recording and sending data, but do not close the session.

None

None

resumeSession() Start recording and sending data again with the existing, current open session.

None

None

showSurvey() Immediately send a prompt to the user that asks for their sentiment.

String theme = 'white' (Optional) Accepts either 'white' or 'black' themes.

None

setAttribute() Used for tagging a session with characteristics. Effectively, only the last value recorded by this session to this chart will appear.

String chart - The name of the chart to record to. String|boolean|int value The value to record to the chart.

None

startSession() Start automatically recording and sending data to Metalitix, which also notifies the platform that a new session has started.

THREE.PerspectiveCamera camera - The object representing the session’s camera. THREE.Object3D scene = undefined (Optional) - Camera transformations will record relative to this object's transformations.

None

Last updated