Sometimes the events captured by your widgets are not enough or maybe you're not even using widgets. Some customers prefer to capture all page views on their website and not only when the page has an Arena Widget. For those situations we've built a Javascript SDK that you can use to identify and send tracking events directly to Arena Personas.
The first step is to install the JS snippet on your website:
Go to Personas and click on the Integrations tab
Expand the Arena Hub section and copy your JS snippet code
3. Paste the snippet on the <head>
tag of your website
After that you'll be able to perform the basic operations: identify
and track
Identify
identify
lets you tie a user to their actions and record traits about them. It includes a unique User ID and any optional traits you know about them like their email, name, etc.
We recommend to call identify
in these situations:
After a user registers or log in
When a user updates their info
After loading a page that is accessible by a logged in user
Here's the Javascript code for the identify
call:
arenaHub.identify('jf8sjgnvsia0381', {
name: "John Doe",
email: "[email protected]",
plan: "business"
})
Track
The track
call is how you record any actions your users perform, along with any properties that describe the action.
Each action is known as an event. Each event has a name, like Subscribed, and properties, for example a Subscribed
event might have properties like plan
or couponCode
Here's the Javascript code for the track
call:
arenaHub.track("Subscribed", {
plan: "Basic Annual",
couponCode: "PROMO10"
});