Creating a Noibu Custom Attribute with GTM Datalayer Values
Last updated: March 20, 2026
This guide explains how to use Google Tag Manager (GTM) to inject custom attributes from your website’s dataLayer into Noibu.
Objective
Use a GTM Custom HTML tag to send existing dataLayer values to Noibu as custom attributes.
Prerequisites
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.
Step 1: Identify Data Layer Variables
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
Step 2: Create a Custom HTML Tag
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
Step 3: Configure the Trigger
Under Triggering, select All Pages or any other trigger where the Noibu SDK is active.
Save your tag.
Step 4: Test in Preview Mode
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.
Step 5: Publish and Verify in Noibu
Click Submit → Publish in GTM.
Open a session in Noibu and verify that your custom attributes appear under Session Details
Troubleshooting
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 |