Integration

Alli Javascript integration is simple and easy. Just copy and paste the following code to your website:

<head>
<script src="https://unpkg.com/@allganize/sdk"></script>
</head>

<body>
<!-- ...Your website content... -->

<!-- Start of Alli Code -->
<script>
  // apiKey is unique identifier provided by Alli 
  Alli.initialize({
    apiKey: "YOUR_API_KEY",
    debug: false, // if you turn this on, debug info will be printed in the console
    backButton: true, // optional, default: true, If you want to remove the back button on the header, turn off this option.
    styleOptions: { // optional, to customize style.
      conversationContainer: {
        right: 50, // offset from the right (applied when SDK position is set to right on project settings)
        left: 50, // offset from the left (applied when SDK position is set to left on project settings)
        bottom: 50 // offset from the bottom
      }
    }
  });
  if (window.Alli) {
    window.Alli.event();
  }
</script>
<!-- End of Alli Code -->
</body>

If you can see Alli’s chat dialog popup in your website bottom right corner, then boom. It’s done!

The following sections explain advanced integration.

Initializing SDK

Copy and paste the code inside your webpage’s <head> block.

<head>
<script src="https://unpkg.com/@allganize/sdk"></script>
</head>

<body>
<!-- ...Your website content... -->

<!-- Start of Alli Code -->
<script>
  if (window.Alli) {
    //apiKey is unique identifier provided by Alli 
    Alli.initialize({
      apiKey: "YOUR_API_KEY",
      debug: false,
      backButton: true
    });
  }
</script>
<!-- End of Alli Code -->
</body>

Starting Conversation

After you have installed the SDK, you can follow one of the following quick and easy integration steps:

Option 1: Getting started. No targeting and no placement. Simply call the below. That’s it.

window.Alli.event();

Option 2: If you know the user and want to specify the placement:

window.Alli.event({
    user: {id: "YOUR_USER_ID"},
    placement: "YOUR_PLACEMENT"
});

Advanced Integration

The advanced integration guide provides detailed explanation of all of Alli’s features.

Identify your users

Alli uses cookies to identify the site visitors who cannot be identified by user id. We will lose the history if the user clears their cookies or goes to a different device.

For users logged into your website and you know who they are, you can tell Alli who they are. You can also set a temporary id for users who are not logged in.

In this example, the user id is USER-123:

Alli.setUser({
  id: "USER-123"
});

If you have more information about your user, you can send it in the setUser() function and we will save it the variables in your project.

Alli.setUser({
  id: "USER-123",
  email: "user123@gmail.com",
});

Placements

One of the most important and unique concepts in using the Alli SDK is placements. Placement is a place and point in time in your app where you might want to display a campaign chat flow to your users.

Static Placements

Once you have created a Placement, you can change the campaign chat flow at that Placement with the Alli Dashboard. You can think of an Alli Placement as a billboard, and an Alli campaign as what gets shown on that billboard. The power of the Placement system is that you can decide what campaign to show at a placement whenever you like.

In this example, the placement is called shopping:

if (window.Alli) {
    window.Alli.setPlacement("shopping");    
}

Dynamic Placements

Alli SDK also sends the URL automatically so that you can use the URL patterns for the dynamic placement in the campaign setting. In this case, the placement is being called like the following:

if (window.Alli) {
    window.Alli.setPlacement();    
}

For example, if you want to start a campaign in the url of “/download”, you can set the placement by using the “contains download” in the dashboard. Please keep in mind that SPA (Single Page App) doesn’t work with Dynamic Placements.

Starting a conversation

Once the user and the placement is set, please call the following:

if (window.Alli) {
    window.Alli.event();    
}

Supported Browsers

  • Chrome (version 64 or above)
  • FireFox (version 60 or above)
  • Opera (version 50 or above)
  • Safari 10 or above
  • Internet Explorer 11
  • Microsoft Edge (version 40 or above)