This guide explains how to use Google Tag Manager (GTM) to inject custom attributes from your website’s dataLayer into Noibu.
Use a GTM Custom HTML tag to send existing dataLayer values to Noibu as custom attributes.
The Noibu JavaScript SDK is already installed and running on your website.
The relevant data points (such as customer city, province, etc.) are available in the GTM dataLayer.
Access to your Google Tag Manager container.
Open GTM and navigate to Variables → New → Data Layer Variable.
Configure each variable that you plan to pass to Noibu.
Variable Name (GTM) | Data Layer Variable | Example Value |
|
| Ottawa |
|
| Ontario |
|
| 3 |
|
| VIP, Returning |
|
| New / Returning |
Reference: Google Tag Manager – Data Layer Variables
In GTM, go to Tags → New → Custom HTML.
Paste the following script:
<script>
(function() {
function addCustomData() {
try {
window.NOIBUJS.addCustomAttribute('customer_city', '{{dlv - Customer city}}');
window.NOIBUJS.addCustomAttribute('customer_province', '{{dlv - Customer province}}');
window.NOIBUJS.addCustomAttribute('customer_session_count', '{{dlv - Customer session_count}}');
window.NOIBUJS.addCustomAttribute('customer_tags', '{{dlv - Customer tags}}');
window.NOIBUJS.addCustomAttribute('customer_visitor_type', '{{dlv - Customer visitor_type}}');
console.log('Noibu custom attributes sent.');
} catch (e) {
console.warn('Noibu custom attribute injection failed:', e);
}
}
if (window.NOIBUJS) {
addCustomData();
} else {
window.addEventListener('noibuSDKReady', addCustomData);
}
})();
</script>
Reference: Google Tag Manager – Custom HTML Tags
Under Triggering, select All Pages or any other trigger where the Noibu SDK is active.
Save your tag.
Enable Preview Mode in GTM.
Navigate your website and open the browser console.
Confirm that the log message Noibu custom attributes sent. appears after each page view.
Verify that no console errors are reported.
Click Submit → Publish in GTM.
Open a session in Noibu and verify that your custom attributes appear under Session Details
Issue | Possible Cause | Resolution |
No custom attributes appear in Noibu | The tag fired before the SDK was ready | Ensure the event listener |
Console error: | SDK not loaded or blocked | Confirm Noibu script loads on the same pages as the GTM tag |
Attributes not populating | Data Layer variables misnamed | Verify variable names match the exact keys in |