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

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

Getting started

1. Integrate the SDK

Add the following code at the end of the <head> section of each page you want to track.

<script id="_webengage_script_tag" type="text/javascript">
    var webengage; !function(w,e,b,n,g){function o(e,t){e[t[t.length-1]]=function(){r.__queue.push([t.join("."),arguments])}}var i,s,r=w[b],z=" ",l="init options track screen onReady".split(z),a="feedback survey notification".split(z),c="options render clear abort".split(z),p="Open Close Submit Complete View Click".split(z),u="identify login logout setAttribute".split(z);if(!r||!r.__v){for(w[b]=r={__queue:[],__v:"6.0",user:{}},i=0;i<l.length;i++)o(r,[l[i]]);for(i=0;i<a.length;i++){for(r[a[i]]={},s=0;s<c.length;s++)o(r[a[i]],[a[i],c[s]]);for(s=0;s<p.length;s++)o(r[a[i]],[a[i],"on"+p[s]])}for(i=0;i<u.length;i++)o(r.user,["user",u[i]]);setTimeout(function(){var f=e.createElement("script"),d=e.getElementById("_webengage_script_tag");f.type="text/javascript",f.async=!0,f.src=("https:"==e.location.protocol?"":"")+"/js/webengage-min-v-6.0.js",d.parentNode.insertBefore(f,d)})}}(window,document,"webengage");


Make sure you replace YOUR_WEBENGAGE_LICENSE_CODE with your WebEngage license code.

This code loads and initializes WebEngage SDK asynchronously, so that it does not affect loading of your web page. This is cautiously done to not impact page load time on your website.
During initialization, this code waits for DOMContentLoaded event before modifying the DOM for loading further resources, ensuring it doesn't delay readiness of the DOM.

The script URLs in the integration code are protocol relative. All our resources are loaded over the same protocol (HTTP or HTTPS) as the containing page, which prevents "Insecure Content" warnings.

2. Add domain to WebEngage dashboard

Add the domain name for which you are performing the integration on WebEngage dashboard. Log in to your WebEngage dashboard, navigate to Integrations > SDK and add your website domain name under the field labeled “Domain” in Javascript tab.

Session lifecycle

WebEngage SDK automatically starts tracking user data (e.g., Browser, OS version, Country) and engagement with the basic setup above.

WebEngage SDK also starts tracking user sessions with this basic setup. Upon leaving the web page, the SDK marks the current time. If the user returns to the web page after more than 30 minutes since the user had last left the page, the SDK will close the previous session. If the user returns to the web page within 30 minutes of leaving, the previous session is resumed as if the user did not leave the web page at all. Please note that this behaviour is recorded only if the resumed session is in the same web browser (can be a different browser window). In case the resumed session is in a different web browser on the same device, WebEngage SDK will record it as a separate session.

Next steps

Congratulations! You have now successfully integrated WebEngage with your website and are now sending user session data to WebEngage.

Note that it may take a few minutes for your data to show up on the WebEngage dashboard. We suggest you meanwhile proceed to read the next sections to learn how to:

  1. Track user properties as attributes
  2. Track user actions as events
  3. Integrate on-site notification
  4. Integrate on-site survey
  5. Integrate on-site feedback
  6. Integrate web push

Getting started