Web SDK
Launch CustomerGlu games, challenges, rewards and nudges on web applications/websites within minutes...
Last updated
Was this helpful?
Launch CustomerGlu games, challenges, rewards and nudges on web applications/websites within minutes...
Last updated
Was this helpful?
Paste the given snippet in your website’s HTML file just before closing the body (</body>
) tag.
Replace the variables with correct values.
You are now ready to load CustomerGlu UI on your website. You can now use:
The Nudges section on the dashboard to add dynamic entrypoints like floating launchers, popups, banners, etc.
The subsequent SDK Functionality to programmatically load campaigns.
On pasting the above script, a global instance glu
will be available in the window.
The glu
instance supports the given methods:
Use the given method to register a user with CustomerGlu:
UserIdentification
follows the given structure:
If the user is not logged in the platform, userId
can be null, and anonymousId
can be passed (an anonympusId will be auto-assigned if not passed explicitly). User progress/state of the campaigns will be linked to the anonymousId
After the user logs in, the same anonymousId
and the userId
can be passed. And progress linked to anonymousId
will be linked with the userId
. If user is already logged in, userId can be passed directly.
UserAttributes
are used for segmentation. They follow the given structure:
customAttributes
can hold any extra key-value pair that might be used for user segmentation/other purposes. Example: {"location":"Mumbai""}
The given function can be used to render CustomerGlu UI fragments on the screen:
container
holds the container details. i.e. If the UI is a bottom sheet, pop up or be embedded etc.
The styling of the container can be customised using the css
property present in each container type. The container elements are targeted using special class names.
Different containers can have same class names for styling, but the styles gets scoped to only the targeted container.
Media queries and your custom CSS variables can also be used inside the string.
All supported container
types are listed down below:
All supported content
types are listed down below:
glu.getCampaignDetails
can be used to get the campaign details. The result include the campaign details and the array of rewards earned for that campaign.
It accepts 2 arguments: filter
and config
filter
helps in identifying the campaign for which the details are needed.
config
has configurations like: should the reward details also exist with the details of the campaign.
You can listen to the analytics events triggered from the glu ui by registering a callback with the SDK’s addAnalyticsListener
method.
glu.addAnalyticsListener
accepts a callback function as an argument. & whenever an analytics event is triggered, it is passed on to the callback as the first argument.
writeKey
is a string that will be provided by CustomerGlu.
At least one function call with both - anonymousId and userId is required to map the anonymousId to the userId after the user logs in.
It returns the promise of a string, that can be used to close the UI using method.
elementHookId
should be a valid html selector or element on the page. The glu container will be appended inside the that element
content
holds details regarding what gets rendered inside the .
The method returns a unique string. Following method can be used to close the frame:
id: unique string returned by method
Schema can be found here: