Javascript SDK integration

The Localytics JavaScript for Apps library is a JavaScript file you include in your web-based application, which can include applications delivered via the application markets as well as direct linking from another site.

At this time, iOS is fully supported and the vast majority of Android devices are supported. In cases where the device is not supported, the library will fail silently and not impact the web application.

  1. In your Localytics Dashboard, create a new application and copy the application key.
  2. Download the Javascript library.
  3. Copy the Localytics JavaScript file to your local web server.
  4. Reference the Localytics JavaScript file on each page of your web application, before any Localytics functions are called.
    <script language="JavaScript" type="text/javascript" src=”/path/to/localytics.js”></script>
  5. On every page load, initialize the Localytics object, open the session, and upload the data.
    Calling open when a session is already open causes it to rejoin the existing open session.
    var localyticsSession = LocalyticsSession("APP_KEY");
    localyticsSession.open();
    localyticsSession.upload();
  6. If desired, pass options to the localyticsSession variable.
Congratulations! You're integrated. Check out the data in your Dashboard or get even more insights when you start tagging events. Don't forget to test your app. Run it in an emulator, or on a real device if possible.