Web Events

Prerequisites

  • The Beemray Web SDK must be loaded on the host website.

Using the Event API

 

Creating an Event

This creates new Event which can be sent to Beemray backend services.

The eventTitle is the title of the sent Event and the endpointUrl is the location of the Beemray backend API where the Event is sent. The endPointUrl should always be “/rest/event/web/plain”.

 

Sending Event to backend services

The created Event can be sent by calling the send(callback) function with callback function as parameter.

 

Sending Event to backend services with timeout

The created Event can be sent by calling the send(callback, timeout) function with callback function and timeout as parameter. The timeout parameter representing the number of milliseconds a request can take before automatically being terminated and the callback executed. The default value is 0, which means there is no timeout.

 

Event Response

The response from backend services which contains the information about the Audiences. The response is available as first parameter of the given callback.

The response is an AudienceFulfillPlainResponse JavaScript Object.

 

Example Event sending with response handling

Example Event sending with request timeout with response handling

Example Event sending with check that Beemray Web SDK loaded and ready to be used


Example Event response Object in JSON format


AudienceFulfillPlainResponse Object properties

property description type
list Contains the information about the Audiences. Array


AudiencePlainMatch Object properties

property description type
id Unique identifier of the entity which identifies the entity on Beemray’s services. Number
title Title of the entity. String
place Place which was used on Audience. Object
source Source which was used on Audience. Object

UserPlaceInfo Object properties

The UserPlaceInfo contains formation about the client’s location data, including personal places.

This information isn’t sent until the client fulfils certain conditions: the client must have visited the pages containing the WebSDKs during several days and several hours.

property description type
clientId The ID of the client. String
state The state of the current place. At the moment, HOME and WORK states are implemented.

The state is set when the client is 150 metres or closer to home or work.

Array
personalPlaces The list of the personal places (max 7). Array

PersonalPlaceInfo Object properties

The PersonalPlaceInfo contains information about the most visited places (1 to 7 places). One of them is automatically selected as HOME and another one of them is automatically selected as WORK.

property description type
accuracy The GPS accuracy (in metres) measured for this place. Number
distanceTo The distance (in metres) from the current place to this place. Number
featured The state of this place. HOME: the place is home. WORK: the place is WORK. String
hits The number of visits (i.e. page loads) in or near this place. (150 metres or closer). Number
lastVisit The latest visit to this place (as a Unix timestamp). Number
lat The GPS latitude of the place. Number
lon The GPS longitude of the place. Array