Issue: If a customer has multiple accounts say for example,

  1. One account from Singapore region &
  2. Another 2 accounts from Mumbai region.

Now if the customer wants to track the user journey of the users from the website, all the 3 accounts tracking script has to be configured in the website.

  • Which will work fine if the customer directly places each region tracking script manually in all the pages of website!  [ But this is not feasible if the customer website has more than 100 pages]
  • But if the customer is using the GTM to install the Tracking script -> The normal of way deploying the tracking script as mentioned in this help doc will will not work for Multi-Region tracking. 

To overcome this we need to load the LeadSquared org ID with the Custom attribute called 'data-lsqoc' in the tracking script - which has to be appended in the <script> tag.

If we place tracking script directly in GTM along with the attribute name as mentioned below -> we are unable to view the same on the website i.e. attribute is not getting loaded/defined.

<!--LeadSquared Tracking Code Start-->

<script type="text/javascript" src="" data-lsqoc="11350"></script>

<script type="text/javascript">



<!--LeadSquared Tracking Code End-->

FYI: GTM is getting failed to load the attribute name when we are passing the attribute name directly in the script as mentioned above.

So we can load the multi-region tracking script along with the attribute name by writing the custom Javascript in the GTM as mentioned below.

Step 1: Create a new tag in the GTM by selecting the tag type as "Custom HTML Tag"  as mentioned below.

Step 2: Here we need to write the custom script to load the tracking as mentioned below.

<!--LeadSquared Tracking Code Start-->
<script type="text/javascript" src=""></script>

<script type="text/javascript">
    var singaporeRegion = document.createElement('script'); // we are defing script tag
    var mumbaiRegion = document.createElement('script');

    singaporeRegion.setAttribute('data-lsqoc','11350'); // defining the attribute called 'data-lsqoc' and setting the ORG ID as value to the attribute

    singaporeRegion.setAttribute('src','');       // defing the src tag with the respective region tracking URL

      document.head.appendChild(singaporeRegion); // Appending both src and data-lsqoc to the script tag
      setTimeout(pidTracker('24778'), 2000);     // Calling pidTracker() function with the respective ORG Id.
      setTimeout(pidTracker('11350'), 2000);
<!--LeadSquared Tracking Code End-->

Note: In the above script I am calling the pidTracker() function using the setTimeout function by giving the delay of 20 seconds to lead each region tracking - But this is not mandatory you can directly call pidTracker() function it will work fine.

FYI: Once the above multiple region tracking script is deployed - You can cross check in the customer website whether it is working fine/not by running the below mentioned command from the browser console.


Hope it helps, Thank you!

LeadSquared Support Team