How to Identify Customers and Track Actions via Embed Code on Leanbe

It is possible to use the Leanbe embed code to identify your customers and track their actions in order to apply it to the customers' score calculation process.

More about the customers' scores can be found here.

Please note, that it is possible to have one embed code for all your products as well as separate embed codes for every single product. More information can be found here.

Ways to use your Leanbe embed code

There are 2 options the Leanbe embed code can be used for:

1. To track the customers' data and activities via the following steps.

  • Insert the embed code on your website. To get the embed code, check this article.
  • Insert the following code to identify the customers which will impact the customer score:
leanbe.push('identify', {

    'email': '',

    'first_name': 'Mike',

    'last_name': 'Clarke',

    'signature': '4d867e5c38dcb8573e95b26d3c963155b605e5c8d58f4f1063fa5e66715631d3',

    'traits': {

    'company': 'Sygnoos',

    'company_id': 'a-120',

    'app_language': 'de',

    'plan_type': 'paid',

    'plan_price': '$120',

    'plan_frequency': 'monthly',

  'plan_tier': 'Platinum',

    'trial_ends': '1599955200',

   'company_country': 'us',

    'login_count': 29,

    'subscription_end_date': '1619205055',

    'subscription_start_date': '1519205055',

    'registration_date': '1519205055',

    'deletion_date': '',

    'phone': '',

    'customer_country': 'Armenia',

    'birth_year': '1992',

   'job_title': 'Product Manager',

    'seniority': 'VP Product',

    'salary': '4000'




For the security purposes you will need to generate a signature and insert it along the code.

In order to generate a signature, it is required to hash the payload data with the Secret Client as follows:

signature = hash_hmac(sha256(secret + payload data)))

Example for Node.js:

const signature = crypto.createHmac('sha256', secret).update(JSON.stringify(payload)).digest('hex');

2. Insert the code to track the actions the customers perform on your website.

  • To track the event when a user starts to use a feature:
leanbe.push('track', {

'event': 'start_using_feature',

'traits': {

'name': 'Announcement'


'signature': 'e6f22159db4c882e4a15e1d41b2061f4d04e148e756ab5c4229167c52c1dd321'

  • To track when a user ends to use a feature:
leanbe.push('track', {

'event': 'end_using_feature',

'traits': {

'name': 'Announcement'


'signature': '07e49c95dafb0b13721169fe8ef6046865329e896fffd46f2a262440b0a33192'



To sump up, by pushing the above information, Leanbe will use it to calculate the customer score.

Additionally, you will be able to check the information about the feature usage upon checking customers details.

That's it! Now you know how to identify the customers and track actions via the embed code on Leanbe.