Javascript-based library that stablishes the communication between an arbitrary client and an receiver API based on the given set of events and actors.
Just change the constants in the config file:
const config = {
api: {
url: 'YOUR_API_URL'
},
storage_prefix: 'YOUR_STORAGE_PREFIX'
};
Initializes the Composite library in the application.
Composite.init({ appKey: 'YOUR_APP_KEY_HERE' });
Whenever the client is initialized, we check the existence of actor_id
in the localStorage. If it doesn't exists, send a request to the API and store the received actor_id. Otherwise, don't do anything.
Composite.registerActor();
The method identifyActor
returns a new actor_id
, which can be a brand new one or an existing one, to replace the existing one in the localStorage.
Composite.identifyActor({
$id: string,
$email: string,
$reservedProps: whatever,
customProps: whatever
});
Register an event with the given name and properties
Composite.registerEvent('purchase', {
value: 1311,
currency: 'EUR'
});
- Fork it
- Create your feature branch (
git checkout -b feature/fooBar
) - Commit your changes (
git commit -am 'Add some fooBar'
) - Push to the branch (
git push origin feature/fooBar
) - Create a new Pull Request