MoEngage Docs

Search results for "{{ search.query }}"

No results found for "{{search.query}}". 
View All Results

Web Javascript SDK Setup

This section describes the integration of Web SDK on your website to track web user attributes and events. In case you are looking for Chrome/Firefox/Opera Push integration, proceed directly to the step-by-step integration flow.

Web SDK Integration

Include the below mentioned MoEngage Web SDK script inside the <head> tag of your website.

  • YOUR_APP_ID_GOES_HERE - Replace this with your account APP ID (find your APP ID on MoEngage Dashboard -> Settings -> App Settings)

  • debug_logs: 1 - This will enable you to see test data in TEST environment - accessed via clicking on toggle button in top bar on Dashboard. Read more about TEST/LIVE environment here

Note: In case you are using Google Tag Manager, you can refer to this section.

<script type="text/javascript">
i['moengage_object']=r;t={}; q = function(f){return function(){(i['moengage_q']=i['moengage_q']||[]).push({f:f,a:arguments});};};
f = ['track_event','add_user_attribute','add_first_name','add_last_name','add_email','add_mobile',
for(k in f){t[f[k]]=q(f[k]);}
i['moe']=i['moe'] || function(){n=arguments[0];return t;}; a.onload=function(){if(n){i[r] = moe(n);}};

Moengage = moe({
debug_logs: 1

Before taking your website LIVE

In case you are taking your website live, DO ENSURE you pass debug_logs: 0 parameter to see Live data in LIVE environment on Dashboard otherwise your Live users will see an alert about the Test environment

Integration via Google Tag Manager (GTM)

You can also place the above SDK script and SDK initialization as a Custom HTML Tag inside GTM. This Tag can be fired once per page and fired on the pages where you wish to track web events/attributes.

You can next proceed to Tracking Website Events. This will help you to send segmented notifications/emails to avoid spamming and target only relevant users who did an event or share a common attribute (such as location).

Web Javascript SDK Setup