JavaScript Events
How to leverage JavaScript events exposed by Spara.
Spara's JavaScript embed snippet exposes three events to your DOM:
Spara.onSparaLoad()
fires when Spara's embed script finishes executingSpara.onUserMessageSent()
fires when a lead sends message to SparaSpara.onUserCTAClick()
fires when a lead clicks a CTA in the Spara chat window. This event includes the label and URL of the CTA as metadata.
These can be used however you like. For example, by pushing these events to your window's data layer for ingestion by Google Analytics.
To access these Javascript events, you will need to add an additional script to your website's <head>:
Last updated