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


Step 1: Identify Data Layer Variables

  1. Open GTM and navigate to Variables → New → Data Layer Variable.

  2. Configure each variable that you plan to pass to Noibu.

Variable Name (GTM)

Data Layer Variable

Example Value

dlv - Customer city

customer_city

Ottawa

dlv - Customer province

customer_province

Ontario

dlv - Customer session_count

customer_session_count

3

dlv - Customer tags

customer_tags

VIP, Returning

dlv - Customer visitor_type

customer_visitor_type

New / Returning

Reference: Google Tag Manager – Data Layer Variables


Step 2: Create a Custom HTML Tag

  1. In GTM, go to Tags → New → Custom HTML.

  2. 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


Step 4: Test in Preview Mode

  1. Enable Preview Mode in GTM.

  2. Navigate your website and open the browser console.

  3. Confirm that the log message Noibu custom attributes sent. appears after each page view.

  4. Verify that no console errors are reported.


Step 5: Publish and Verify in Noibu

  1. Click Submit → Publish in GTM.

  2. 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 noibuSDKReady is included

Console error: NOIBUJS is undefined

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 dataLayer