Core Objects and Events

The Lead Booster API includes a base set of functions that are always available, no matter which packages are loaded. These are cross-industry, common behaviors supported by the API.

The API uses the concept of JSON Schemas extensively. For more information about how JSON Schemas work, and how to validate your data against a schema, visit json-schema.org.

Analytics Package

The majority of Lead Booster API events and related objects are defined in the Analytics Schema. These events handle all common activity a user performs on a website, such as authentication and page views.

Basic Functions

There are three core functions unrelated to event tracking, devMode, load and setAPIKey. These are the only functions not validated by a JSON schema.

devMode

Runs the library in local development mode. No data will be sent to the Lead Booster Analytics API. Each time the brytescore function is called, it will log the data object to your console. You can copy and paste this object into a JSON validator to catch syntax errors.

/* brytescore devMode syntax */

brytescore( "devMode", true );

load

Loads a package. Lead Booster Analytics packages are encapsulations of rules, objects, and events that create business rules boundaries for the API when scoring leads and predicting user behaviors.

Parameter Type Required Description
packageURL string yes The direct URL to the package to load.
/* brytescore load syntax */

var packageURL = "https://cdn.brytecore.com/packages/realestate/package.json";

brytescore( "load", packageURL );

setAPIKey

Sets your API key. Required to track events.

Parameter Type Required Description
apiKey string yes Your Lead Booster API key for this website
/* setAPIKey syntax */

brytescore( "setAPIKey", apiKey );

Basic Schemas

The Lead Booster API includes a basic set of schemas that make re-use of common objects easy. These are exposed as data types in the event schemas.

address

A physical or mailing address.

Parameter Type Required Description
streetAddress string no The house number and street address
streetAddress2 string no The apartment, suite, or other secondary address
city string no The city or municipality part of the address
stateProvince string no The state or province
zipPostal string no The postal or zip code
country string no The name of the country
/* address example */

var address = {
	"streetAddress": "84 Rainey Street",
	"city": "Arlen",
	"stateProvince": "TX",
	"zipPostal": "75040"
}

form

A user-submitted data entry form.

Parameter Type Required Description
fromEmail string no The email address of the sender
fromName string no The name of the sender
fromTelephone telephone no The telephone number(s) of the sender
message string no The contents of the message provided by the sender
name string no The name of the form (ex: contact, about, etc)
subject string no The subject of the form or email
toEmail string no The email address of the person to which the form was sent
toName string no The name of the person to which the form was sent
/* form example */

var form = {
	"fromEmail": "info@ivankatrump.com",
	"fromName": "Ivanka Trump",
	"fromTelephone": {
		"mobile": "212.555.0001",
		"home": "212-555-0100"
	},
	"message": "Real estate is my day job. But it consumes my nights and weekends, too.",
	"name": "testimonial-request-form",
	"subject": "Thoughts on real estate",
	"toEmail": "agent@yourcompany.com",
	"toName": "Suzie Agent"
}

geo

A geographical coordinate, used to plot locations on a map.

Parameter Type Required Description
latitude number yes The latitude, in decimal
longitude number yes The longitude, in decimal
/* geo example */

var latLng = {
	"latitude": 33.9127722,
	"longitude": -84.3601298
}

telephone

A set of one or more telephone numbers.

Parameter Type Required Description
mobile string no A mobile telephone number
home string no A home telephone number
work string no A work telephone number
fax string no A fax number
direct string no A work direct line telephone number
/* telephone example */

var telephone = {
	"mobile": "636-KL5-3226",
	"home": "(212) 555-2368"
}

userAccount

An authenticated user account of the website or application.

Parameter Type Required Description
id string no The user id of the account
emailAddress email no The email address associated with the user account
firstName string no The first name of the user
lastName string no The last name of the user
/* userAccount example */

var userAccount = {
	"id": "42",
	"emailAddress": "fordprefect@milkywayguides101.com",
	"firstName": "Ford",
	"lastName": "Prefect"
}

Authentication Events

The authenticated, registeredAccount and updatedUserInfo events help Lead Booster understand who your users are by providing their contact information and associated user account data. It is important to capture all of these events when they happen in your system in order to provide the lead contact information to the CRM, which in turn provides this information to your agents.

authenticated

The user logged into your application or website.

Parameter Type Required Description
userAccount userAccount no The details of the user account.
address address no The address provided by the user.
telephone telephone no The telephone number(s) provided by the user.
isLead boolean yes The registered user is a lead. Sometimes a user who registers on your site is not a lead (such as a test account or staff member).
userClassification string no Your classification of this user. Optionally used to segment your leads.
dateRegistered date-time no The date the user registered in the system. Defaults to current date and time. (ISO 8601 String)
/* authenticated example */

// Build nested objects
var userAccount = {
	"id": "75",
	"emailAddress": "gump@bgcfood99.com",
	"firstName": "Bubba",
	"lastName": "Gump"
}

var address = {
	"city": "Savannah"
}

var telephone = {
	"home": "912-555-0840"
}

// Build the data object
var data = {
	"userAccount": userAccount,
	"address": address,
	"telephone": telephone,
	"isLead": true,
	"userClassification": "Google Lead",
	"dateRegistered": ""
}

// Call the event
brytescore( "authenticated", data );

registeredAccount

The user registered an account on your application or website.

Parameter Type Required Description
userAccount userAccount no The details of the user account.
address address no The address provided by the user.
telephone telephone no The telephone number(s) provided by the user.
isLead boolean yes The registered user is a lead. Sometimes a user who registers on your site is not a lead (such as a test account or staff member).
userClassification string no Your classification of this user. Optionally used to segment your leads.
dateRegistered date-time no The date the user registered in the system. Defaults to current date and time.
/* registeredAccount example */

var userAccount = {
	"id": "5",
	"emailAddress": "hi@my-azquints.net",
	"firstName": "H.I.",
	"lastName": "McDunnough"
}

var address = {
	"city": "Raising",
	"stateProvince": "AZ"
}

var telephone = {
	"home": "480.555.6162"
}

var data = {
	"userAccount": userAccount,
	"address": address,
	"telephone": telephone,
	"isLead": true,
	"userClassification": "Google Lead"
}

// dateRegistered will default to now.

brytescore( "registeredAccount", data );

updatedUserInfo

The user updated their contact information.

Parameter Type Required Description
userAccount userAccount no The details of the user account.
address address no The address provided by the user.
telephone telephone no The telephone number(s) provided by the user.
/* updatedUserInfo example */

var userAccount = {
	"id": "66",
	"emailAddress": "chewie@awwwrrrawwhh.com",
	"firstName": "Chewbacca",
	"lastName": "Rahhggaahh Urughaghhh"
}

var address = {
	"streetAddress": "298-B24DC Wroshyr Tr",
	"city": "Thikkiiana",
	"stateProvince": "Woolwarricca",
	"postalCode": "P85D-2",
	"country": "Kashyyyk"
}

var telephone = {
	"home": "11381138",
	"mobile": "5041977"
}

var data = {
	"userAccount": userAccount,
	"address": address,
	"telephone": telephone
}

// dateRegistered will default to now.

brytescore( "updatedUserInfo", data );

Lead Booster Analytics Events

pageView

The user viewed a page. This event is tracked by default inside the Lead Booster Analytics API snippet. Whenever the Analytics library detects a URL change, a new page view is automatically logged.

The pageview event supports Google Analytics UTM codes. You can provide these manually, or they will be automatically tracked if omitted from the event but present in the URL. Learn more about UTM codes on the Google Analytics URL Builder help page

Parameter Type Required Description
referrer string no Override the referring page.
pageTitle string no Override the title of the page.
pageURL string no Override the URL of the page.
utmSource string no Where the campaign originated.
utmMedium string no The campaign medium, for example email or cost-per-click.
utmTerm string no The search term used by the campaign.
utmContent string no Used to differentiate different ads landing on the same page.
utmCampaign string no The name of your campaign.
/* pageView example */

// Call the event with default and auto-determined values.
brytescore( "pageView", {} );

submittedForm

The user submitted a form via the application or website.

Parameter Type Required Description
form form no The details of the form submitted.
/* submittedForm example */

// Create the form object
var form = {
	"fromEmail": "george@bagels1964.com",
	"fromName": "George Hairyson",
	"fromTelephone": {
		"home": "0843 850 2090"
	},
	"message": "Hi my name is George and I'm looking for an agent to help me sell my home in London.",
	"name": "contact-us",
	"subject": "looking for an agent",
	"toEmail": "info@mycompany.com"
}

// Call the event with the data object containing the form.
brytescore( "submittedForm", { "form": form } );

System Events

System events are handled internally by the Lead Booster Analytics API client and should not be called by your code directly.

brytescoreUUIDCreated

Tracks when the system creates a tracking cookie on the user's machine to track behavior of anonymous users, which can later be tied to an authenticated user with one of the Authentication events.

heartBeat

Tracks how long the user remains active on your website. This is used to calculate session and page view lengths. Heartbeats trigger every 15 seconds and cease after 30 minutes of inactivity.

sessionStarted

Tracks when a new user session is started. User activity is generally grouped and reported by session.

Copyright © 2018 Brytecore, Inc.Privacy PolicyTerms