NoibuJS SDK

The NoibuJS SDK allows you to interact with information Noibu Captures by creating a custom attribute for your session.  

 

The NoibuJS SDK can be accessed from the global window object.  The NOIBUJS attribute is set on the window object as soon as our script loads.  Before using the SDK, you should check if it is defined.  A way you can do that is as follows:

 

Screen_Shot_2022-03-29_at_9.43.14_PM.png

This function checks if the window object has NOIBUJS attribute every 3 seconds and once found, stops the interval calls the function within the SDK.  The function is addCustomAttribute.  

 

addCustomAttribute function

 

The addCustomAttribute function will add a custom attribute to the session you are working on, helping you isolate it on the Noibu platform.  The attribute can be used to search noibu sessions in session search, click here for more information on session search.  You can use both name value or attribute value to search session search. Searching by the name will return all the sessions where that id with that name was used. Searching by value will only return the sessions where the value matches the value searched. If you want to match the name and value, then use both filters in session search.  

 

addCustomAttribute can be used in a variety of ways.  Here are a few examples of the use for this function:

Create a custom attribute for Customer ID:

window.NOIBUJS.addCustomAttribute('customerID', '934739856')

Create a custom attribute for a marketing campaign:

window.NOIBUJS.addCustomAttribute('campaign', 'BlackFridayCampaign')

Create a custom attribute for logged in status:

window.NOIBUJS.addCustomAttribute('isLoggedIn', 'True')

Create a custom attribute for an A/B test:

window.NOIBUJS.addCustomAttribute('variant', 'A')

 

These are just a few use cases and the capabilities of the use is within your hand.  

 

Parameters 

  • name: The name of the attribute
  • value: The value of the attribute

Validation

  • name: String, with maximum 50 characters
  • value: String, with maximum 50 characters

Limitations

Only 10 attributes can be added per page. Every time the user causes the page to reload that counts as a new page. So for example if a user visits 10 pages, then you can have 100 attributes in that session, since each page can have up to 10 attributes.

Here are some examples of inputs that do not work with the addCustomAttribute function:

Screen_Shot_2022-03-29_at_9.43.45_PM.png

As you can see, once you set an id with a name, you can not set an id with that name again even with a different value.  You cannot also use an object or number as a parameter, the function only takes strings. 

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.