Add the AptEdge snippet to Zendesk Guide
- From the Guide Admin portal, select the Themes tab.
- Under Live Theme, select Customize.
- In the bottom right corner, select Edit code.
- From the list of files, scroll down and open
script.js. - At the bottom of the page, paste the AptEdge snippet that you copied.
- Select Publish to save your changes.
Set user info from Zendesk
If the user is authenticated, set their name and email in the user key to enable AptEdge to identify them in usage analytics, to gather feedback, to target Proactive Answers, and for personalization.
In Zendesk Guide, we can get the user attributes from the global HelpCenter object.
For example:
let user = {};
if (HelpCenter?.user?.email && HelpCenter?.user?.name) {
// The user is authenticated
user = {name: HelpCenter.user.name, email: HelpCenter.user.email};
}
const aptedgeConfig = {
apiKey: "API_KEY",
instanceName: "INSTANCE_NAME",
user: user };
// Remainder of install scriptControl which users see AptEdge
You can restrict the visibility of AptEdge to specific users and user groups using conditional statements before initializing AptEdge in the script.js file:
if ( some condition ) {
// Add AptEdge snippet here
}
Attributes of the current signed-in user, such as their email, tags, role, and groups are accessible using the HelpCenter object provided by Zendesk. To see the available attributes:
- Open the Help Center in your browser and log in.
- Open the console in Developer Tools. Refer to these instructions if you’re using Chrome.
- Type in
HelpCenter, then press Enter to view the details of the object.
For instance, to show AptEdge only for users with the tag “foo”:
if ( HelpCenter.user.tags.includes('foo') ) {
// Add AptEdge snippet here
}
Similarly, to limit AptEdge for users with the organizational tag called “bar”:
if ( HelpCenter.user.organizations.some(
org => org.tags.includes('bar')
) ) {
// Add AptEdge snippet here
}
Comments
0 comments
Article is closed for comments.