Quick Start

Implementing Brytelytics on Your Web Server

This page will help you understand how to implement Brytelytics on your web server, complemented by a simple client-side snippet to track simple events like sessions and page views.

If you want to instead use client-side tracking (not recommended for websites), you can access those instructions on the Client-Side Tracking page.


Brytelytics is a real estate analytics service for real estate websites and mobile apps. Real estate companies use it to better understand their online consumers, if they are buyers, renters, or sellers, when and where they are looking to move, what home features they are interested in, and how close they are to needing a real estate agent.

Obtaining an API Key

Events are rolled up to an API key and the parent real estate company. Inside the Brytelytics dashboard, brokers can select a specific key, or see all events across the company, even across other vendors that use Brytelytics.

Your Brytecore developer liaison can provide you with an API key for each website or app in which you want to install Brytelytics. If you are a Brytecore Partner, you can create keys via the Brytecore API or through the Vendor Provisioning Dashboard.

Loading the JavaScript Snippet

Brytecore provides a small snippet of JavaScript code to handle sessions, page views, anonymous users, and heartbeats to calculate session length. The unique IDs of these items are required when sending tracking events to the API. It also creates persistent first-party cookies to relate multiple user sessions.

You should place the snippet in the HEAD section of all web pages in your real estate website. The snippet asynchronously loads the brytescore.js file from the Brytecore CDN, which then loads the required rulesets and events (called packages) for your business.

Including the snippet will not have a performance impact on your website and will not block other JavaScript calls, even if it errors or is unable to load the brytescore.js file.

Including the snippet is just the first step! You must still track each triggered event from your server code via HTTP POSTs to the Brytecore API. These steps are described later in this guide.

Please note that these instructions recommend using the Brytescore snippet for session management. If you decide against using the snippet you will need to handle this yourself, which is outside the scope of this guide. Please talk with your developer liaison before making this choice.

Paste the Brytelytics snippet into your pages

Copy and paste this code into your site header, inside the HEAD section of each page. This can usually be performed inside a server-side include or templating engine partial. Replace YOUR_API_KEY with your own key.

<!-- Brytescore -->
	(function(a,c,g,e,d,f,b){e[d]=e[d]||function(){(e[d].q = e[d].q || []).push( arguments )};e[d].t=1*new Date();
	b=a.getElementsByTagName( c )[0];f=a.createElement(c);f.async=1;f.src=g;b.parentNode.insertBefore(f,b)})
<!-- End Brytescore -->

The minified brytescore.js file can be downloaded directly from the CDN link below, and you can view the source code on GitHub.

Analysis of the JS Snippet

To install the API on your website, you can simply copy the minified snippet into the HEAD section of each page on your website. We recommend the HEAD section in order to begin the asynchronous load as soon as possible in the page load lifetime.

The snippet creates a SCRIPT section in your web page that accepts calls to the brytescore() function while asynchronously loading the brytescore.js file from the Brytecore CDN.

The setAPIKey command is required and allows you to pass your API Key to the Brytecore servers during event logging. See the Functions Reference for details on the core functions available in the Lead Booster API library.

The pageView command simply tracks the page view of the person loading the page. There are some optional parameters you can manually pass more details about the page view. See the Core Package Reference for more details about page views and sessions.

The load command loads the real estate package, which contains the valid events and objects that feed into the Brytelytics algorithms supporting real estate. See Real Estate Package Reference for more info.

The minified snippet is located in the previous section. The code below is the unminified version, which is only for reference.

/*	Unminified Brytelytics JavaScript snippet
	Not recommended for production. Use minified snippet instead. */

(function ( document, script, script_source, window, name, generated_script, calling_script ) {
	'use strict';
	window[name] = window[name] || function() {
		( window[name].q = window[name].q || [] ).push( arguments );
	window[name].t = 1 * new Date();
	calling_script = document.getElementsByTagName( script )[0];
	generated_script = document.createElement( script );
	generated_script.async = 1;
	generated_script.src = script_source;
	calling_script.parentNode.insertBefore( generated_script, calling_script );
})( document, 'script', 'https://cdn.brytecore.com/brytescore.js/brytescore.min.js', window, 'brytescore' );

brytescore( 'setAPIKey', 'YOUR_API_KEY' );
brytescore( 'pageView', {} );
brytescore( "load", "https://cdn.brytecore.com/packages/realestate/package.json" );

You can always find the latest version of the unminified snippet on GitHub.


The Brytelytics snippet uses a first-party cookie to connect user sessions across visits and store the generated unique IDs for sessions, page views, and users. You will need to retrieve this data from the cookie in order to send properly formatted events to the API.

The Brytelytics snippet creates three cookies, outlined below. You can access the properties of each from your server code to get the information you need. Make sure to URL decode the data from the cookie before accessing it.


Contains API key data. This field is available:

  • apikey: The current Brytelytics API key


Contains the user's session data. These fields are available:

  • sid: the current session ID, stored as a version 4 UUID.
  • aid: a version 4 UUID identifying this user across sessions. Often called the Brytescore user ID, or anonymous ID.
  • brw: the current user's browser string.


Contains the user identification data. These fields are available:

  • aid: a version 4 UUID identifying this user across sessions. Often called the Brytescore user ID, or anonymous ID.
  • uid: the user ID provided by the vendor from previous authentication, registration or other events. This will be your internal user ID if you've ever provided it.

Sending Events to the API

To send a Brytelytics event to the API, you will need to send an HTTP POST request to https://api.brytecore.com/boost. No authentication is necessary for this call, but some fields are required, per the next section.

HTTP POST example for the pageView event

This is an example of an HTTP POST via curl. You will likely use a package or library for your specific server language to handle your HTTP POST requests, rather than a curl call.

curl --location --request POST 'https://api.brytecore.com/boost' \
--header 'Content-Type: application/json' \
--data - raw '{
	"event": "pageView",
	"date": "2020-07-24T17:09:03Z",
	"ipAddress": "",
	"hostName": "yoursite.com",
	"apiKey": "29870424-689a-49c2-b34b-e43aef627154",
	"anonymousId": "10976b15-d02e-4a01-95cd-84bfa4150b6c",
	"userId": "12345",
	"pageViewId": "27e92a06-554c-4c16-96dc-3a5b98c51381",
	"sessionId": "41f949b0-9e89-4a21-981e-f0ed92dfef05",
	"data": {
		"pageUrl": "https://yoursite.com/listing/110636371",
		"pageTitle": "2425 West 36th Street, Chicago, IL 60609 - 5 bed/4 bath",
		"referrer": "https://yoursite.com/search/"

Formatting Your API Calls

POSTs need to include a JSON object payload with specific fields on every call. The object structure includes the following case-sensitive properties:

  • anonymousId [string]: the aid property from the brytescore_uu cookie
  • apiKey [string]: your Brytelytics API key
  • data [object]: the JSON object payload for the event you are tracking
  • date [string]: an ISO 8601 UTC date string with the exact date and time the event was triggered, ex: 2020-07-24T17:09:03Z
  • event [string]: the Brytelytics event you are tracking
  • hostName [string]: the host name for the current URL
  • ipAddress [string]: the client's IP address
  • pageViewId [string]: a UUID v4 string containing a unique value for the current page view
  • sessionId [string]: the sid property from the brytescore_session cookie
  • userId [string] [optional]: your user ID for the current user (if available)