Install tracking with Tag Manager

  1. Create Tag Manager account correspond with your data platform.

    Just fill out the form and click Create. If you have an account, you can skip this step and move to step 2.

  2. Install Google Tag Manager script to your platform.

    After your account created, you will see Google Tag Manager’s (GTM) installation instruction. Just follow the guide.

    If you miss the the instruction, just click the key to reopen it

  3. Config GTM Tag to use DiAnalytics ********Web SDK

    Assuming DiAnalytics is installed and DiAnalytics.init(<UNLOCK_CI_DOMAIN>, <API_KEY>) is called in your platform.

    1. Assuming your website had the script below:

      <button onclick="dataLayer.push({event: 'click_save_button', data: ''})">This is a button</button>

    2. Config Custom Trigger

      1. Go to Triggers tab → Select New button → Click on Trigger Configuration

      2. Select Custom

      3. Click on Save with name “Click Save Data”

    3. Config Variables

      Built-in variables are default variables, which are provided by GTM. In this case, we show you how to config custom variable

      1. In User-Defined Variables frame, Click on New → Click on Variable Configuration → Select Data Layer Variable

      2. We use ‘data’ to set for Data Layer Variable Name for this example

      3. Click on Save with name ‘Data’

    4. Config GMT Tag with Custom Trigger

      1. Select Add a new tab

      2. Select Tag Configuration

      3. Select Custom HTML

      4. Insert the javascript code into GTM Custom HTML Tag


        window.DiAnalytics.track("click_save_data", { data: {{ Data }} })


        Data: configured variable at Step 3.2

        We use window.DiAnalytics.track function so that we could track general event info. In addition to, we have already defined details tracking functions. You can use more DiAnalytics’s functions, depending on which functions are needed in your application.

      5. Scroll down and Click on Triggering

      6. Select ‘Click Save Data’ Trigger saved at Step 2.3

      7. Click on Save and Publish

      8. Your setup GTM is successful

Last updated