This document provides step-by-step instructions for integrating Nitro's JavaScript API into your website.
It explains how to use various methods to track custom events, and implement Nitro's tracking features after manually installing the script.
Add the Nitro installation script inside the section of your website.
The script should be added to every page where visitor activity needs to be tracked.
<script type="text/javascript">
(function(n,i,t,r,o) {
var a,m;n['NitroObject']=o;n[o]=n[o]||function(){
(n[o].q=n[o].q||[]).push(arguments)},n[o].l=1*new Date();n[o].h=r;a=i.createElement(t),
m=i.getElementsByTagName(t)[0];a.async=1;a.src=r;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://x.nitrocommerce.ai/nitro.js','nitro');
nitro('configure', '<YOUR_ORG_TOKEN>');
</script>
Note: Replace <YOUR_ORG_TOKEN> with the token provided by the Nitro team.
Trigger the identify method when a visitor logs in, creates an account, submits their contact information, or becomes identifiable to track their activity on the website.
nitro.identify(
"<VISITOR_EMAIL>",
"<VISITOR_PHONE>",
"<VISITOR_NAME>",
{
source: '<SOURCE>',
template_id: "",
org_token: "<YOUR_ORG_TOKEN>",
is_consented: true,
otp_verified: true
}
);
Note: Depending on the location where the user provides their information, the source parameter should be set to brand_popup, brand_lead_form, brand_account_login, or brand_checkout. Please ensure you swap <YOUR_ORG_TOKEN> with the specific token issued by the Nitro team.
Use custom events to track additional actions that are specific to your website.
Examples include:
● Wishlist addition
● Form submitted
● CTA clicked
<script>
var payload = {
page : '<PAGE_URL>',
KEY_1: 'VALUE_1',
KEY_2: 'VALUE_2'
};
if (!window.nitro) {
window.nitroSettings = {
ready: function (orgId, roamingId, nitroId) {
nitro.track('<EVENT_NAME>', payload);
}
};
} else {
window.nitro.track('<EVENT_NAME>', payload);
}
</script>
Note: The key-value pairs can be customized with specific parameters or attributes, such as customer email, phonenumber, name, and more, as needed.
Integration Checklist
Before completing the integration, verify that:
● The Nitro script is present on all website pages
● The correct organisation token is configured
● Phone numbers and email addresses are passed correctly
● Event values are populated dynamically
● No event is being triggered multiple times for the same action
Once the setup is completed, inform the Nitro team so that the integration and incoming events can be validated.