OpL Insights

Docs Any website

Identify signed-in users

Tell OpL Insights who is signed in, from your server or from JavaScript.

Your site knows who is signed in; OpL Insights doesn't. Pass the user to the script and it appears as the user ID in the visits log, the visitor profile and next to every recording.

Use something stable that identifies the person to you: a login, an e-mail address or a customer number. It can be up to 190 characters.

When the server renders the page

If your server knows the user when it builds the page, write it into the configuration:

<script>window.OPL_INSIGHTS = { m: 'https://insights.opl-web.com/', s: 129, uid: '[email protected]' };</script>

Leave uid out, or empty, for visitors who aren't signed in.

When your JavaScript knows

Single-page apps often learn who is signed in after the page has loaded. Push the user onto the queue whenever you know it; this works even before the OpL Insights script has loaded:

(window._oplq = window._oplq || []).push(['setUser', '[email protected]']);

When the user signs out:

(window._oplq = window._oplq || []).push(['clearUser']);

Once the script has loaded you can also call it directly:

OplInsights.setUser('[email protected]');
OplInsights.clearUser();

Make the first page view count

By default the first page view is sent straight away. If your app finds out who is signed in a moment later, that first page view is anonymous. Set waitForUser to hold it back for up to that many milliseconds (5000 at most); it is sent as soon as you call setUser or clearUser:

<script>window.OPL_INSIGHTS = { m: 'https://insights.opl-web.com/', s: 129, waitForUser: 2000 };</script>

Signing in during a visit

If someone signs in part-way through a visit, call setUser at that point. The following page views carry the user, and OpL Insights continues the visit as theirs.

For a complete example, see the Axelor guide: a small script on the Axelor side reads the signed-in user from Axelor and passes it on.