leiratech_trackzero

Last updated:

0 purchases

leiratech_trackzero Image
leiratech_trackzero Images
Add to Cart

Description:

leiratech trackzero

Usage #
Initialization #
Initialize the TrackZeroClient instance by passing in your API key before using any of the methods.
var instance = new TrackZeroClient("API-KEY");
copied to clipboard
Getting Started #
TrackZero Instance #
After initializing the TrackZero instance, you could get the instance anywhere in your project
var instance = TrackZeroClient.getInstance();
copied to clipboard
Entity #
Entities are objects that contain data. It can represent any object in the real world. Each entity is defined by it’s Type and Id.
Create an Entity object
///Initializes the Entity object
///
///[type] - Entity's type
///[id] - {String | int} - Entity's id

Entity entity = new Entity("type", "id");
copied to clipboard
Add Attributes
///Adds custom attributes to the entity
///
///[attribute] - Entity's attribute name
///[value] - Entity's attribute value

entity.addAttribute("attribute", "value");
copied to clipboard
Add Attributes Referencing Other Entities
///Adds custom attributes to the entity that are related to another entity
///
///[attribute] - Entity's attribute name
///[referenceType] - Related to entity type
///[referenceId] - {String | int} - Related to entity id

entity.addEntityReferencedAttribute(
"attribute",
"referenceType",
"referenceId"
);
copied to clipboard
Track Entity
///Creates/Updates the Entity
await instance.upsertEntity(entity);
copied to clipboard

Note: Upsert (Update/Insert) is applied when sending the entity. So, if the the entity of type X with id Y already exists, then it gets updated, else a new entity is created. This also applies to the entity's referenced attributes in addEntityReferencedAttribute.

Complete Entity Example
Entity user = new Entity("User", "USER_ID")
.addAttribute("Name", "Sam Smith")
.addAttribute("Date Of Birth", DateTime.utc(1990, 12, 23).toIso8601String()) //Make sure dates are in ISO8601 String
.addEntityReferencedAttribute("Location", "Country", "US");

await instance.upsertEntity(user);
copied to clipboard
Delete Entity

❗   Deletion is permanent and cannot be undone.

///Deletes the Entity
///
///[type] - type of entity to be deleted
///[id] - {String | int} - id of the entity to be deleted

await instance.deleteEntity("type", "id");
copied to clipboard
Analytics Spaces #
Each analytics space represents a separate database storing analytical data relevant to a specific subject/entity user defined.
Each analytics space is able to build reports and dahsboards in TrackZero's space portal.
Get a Space Portal Session
///Creates a space portal session
///
///[analyticsSpaceId] - the analytics space id
///
///[ttl] - (in seconds) - default set to 3600 - time to live, when the session expires

await instance.getSession(analyticsSpaceId, ttl);
copied to clipboard
Resources #
Changelog
License #
MIT

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.