Parlor's Javascript snippet enables to you to send Parlor data about your users and their product usage and empowers all of Parlor's engagement widgets.
Register your Product
How to Register your Product
1. Within Organization Settings, visit the 'Manage Environment' page.
2. Click the Add Product button.
3. Provide a Product Name and at least one URL. The URL must contain either 'http' or 'https'.
Install the Javascript Snippet
To install the Parlor snippet, simply paste either of the two code snippets below into the <head> tag of your application. You'll need to insert the API Token that is unique to your instance, which is located in the 'Manage Environment' within Organization Settings of your Parlor account.
Depending on your application’s authorization flow and if your users are known before your app loads, you’ll have two options to choose from when installing the Parlor snippet.
Option 1:
If you know the uid of your users upon page load, you can set parlorConfig before loading the parlor script.
window.parlorConfig = {
user: {
uid: 'test-user-id' // set user id
email: "example@example.com", // optional
apiToken: <inset-parlor-api-token>
},
};
!function(){var e=window;if(!e._Parlor){var t=document,a=function(){var e=t.createElement("script");e.type="text/javascript",e.async=!0,e.src="https://widget.parlor.io/latest/index.js";var a=t.getElementsByTagName("script")[0];a.parentNode.insertBefore(e,a)};"complete"===document.readyState?a():e.attachEvent?e.attachEvent("onload",a):e.addEventListener("load",a,!1)}else console.warn("Parlor already loaded.")}();
Option 2:
If you don’t already know your user’s UID when the page loads you should call Parlor._identify() when that information is available.
!function(){var e=window;if(!e._Parlor){var t=document,a=function(){var e=t.createElement("script");e.type="text/javascript",e.async=!0,e.src="https://widget.parlor.io/latest/index.js";var a=t.getElementsByTagName("script")[0];a.parentNode.insertBefore(e,a)};"complete"===document.readyState?a():e.attachEvent?e.attachEvent("onload",a):e.addEventListener("load",a,!1)}else console.warn("Parlor already loaded.")}();
--- later ---
window._Parlor.identify({
apiToken: <inset-parlor-api-token>,
firstName: "Jon", // optional
lastName: "Doe", // optional
uid: "73969",
email: "example@example.com", // optional
Note: Both of these options are pre-generated on the Widget Installation page within your Parlor account with the API Token pre-filled for easy copy & paste into your code.