Website

Connect Kiflo to your website

First install KifloJS snippet to track visits/signups

KifloJS is a javascript snippet that reads browser cookies and sends visit and signup information back to your Kiflo account.

  1. Go to Kiflo Account > Integration.

  2. Copy the Kiflo Javascript Snippet.

  3. Paste the snippet in the <head> section of all the webpages you need to track.

  4. Each time a new user signs up on your website, call the createSignUp function

<!- Example Signup form ->
<input id='firstname' type='text'>
<input id='lastname' type='text'>
<input id='email' type='text'>
<input id='submit' type='button' onclick='signup()'>
<script>
function signup() {
// Get data from form
var firstname = document.getElementById('firstname').value;
var lastname = document.getElementById('lastname').value;
var email = document.getElementById('email').value;
var externalId = 'your_internal_customer_ID';
// Notify Kiflo from a new SignUp
rjs.createSignUp(externalId, firstName, lastName, email,
function() {
// User signed up successfully
}, function(err) {
// There was an error during the sign up
switch (err.errorCode) {
case "BadRequest":
console.log('Some input parameters were invalid: ' + err.errorMessage);
break;
case "TechnicalError":
console.log('Technical error: ' + err.errorMessage);
break;
default:
console.log(err);
break;
}
});
}
</script>

Then call Kiflo API to trigger rewards on new sale

  1. Go to Kiflo Account > Integration.

  2. Generate a new API access token

  3. When a new sales is made, create a new Deal from Kiflo API

This access token must be considered like a password and should never be disclosed. Be sure to store it in a secure way.

More details about Kiflo API

Valid error codes for createSignUp()

When the createSignUp() is called with errors, here are a non-exhaustive list of expected errors:

Tracking.NoCookieSent

The Kiflo tracking cookie was not present in the request headers.

Tracking.InvalidCookie

The Kiflo tracking cookie is invalid or unknown.

Contacts.AlreadyExists

The contact with the given email or external ID already exists. For more information please check the errorMessage property in the error object returned.

BadRequest

The input parameters are invalid (ex: missing required property). For more information please check the errorMessage property in the error object returned.