Custom attributes can be used to send information about your learners from Pathwright to Intercom. When you're responding to a learner in Intercom's chat app, or sending a targeted email, you can see the custom information that has been tracked for that learner and use it to provide more accurate communications.
You'll need to first integrate your Intercom account with Pathwright before adding custom attributes. If you've already done that, continue to the steps below.
How to add a custom attribute
You can paste the script for the desired custom attribute (you'll find these listed below) under your Account Settings from the menu or Dashboard.
💡Tip: To see the custom attributes on Intercom after installing the code, you may need to wait 30 seconds and reload Intercom.
Sample custom attributes
Track the courses each learner is taking
Each learner that registers will receive a unique, custom attribute in Intercom each time they register for an offering.
The attribute will begin with "STUDENT_REGISTERED_FOR_COURSE_" and end with the ID of the course. The value of the attribute will be true.
Here's how to find a course ID number for any of your courses. Find the course in your Pathwright account and open "Course Settings." With the Course Settings open, examine the URL. There will be a number at the end of the URL that looks something like this: manage/resource/01234/. Those ending digits form your course ID number.
So, in this case, the student would receive the attribute STUDENT_REGISTERED_FOR_COURSE_01234
Paste this under Account Settings > Connect other apps > Add custom code & pixel tracking > Inject code into the body
<!-- track custom attribute in Intercom for when student registers for course -->
<script>
document.addEventListener("registration:created", function (e) {
// Grab the resource ID from the event details
const resourceId = e.detail.resource.id
const updates = {
// Include registration attribute
["student_registered_for_course_" + resourceId]: true
}
if (window.Intercom) {
// Add the attribute to the user in Intercom
window.Intercom("update", updates)
}
})
</script>
Track the Cohorts each learner is enrolled in.
Each learner that registers will receive a unique, custom attribute in Intercom each time they register for a Cohort, or single class offering.
The attribute will begin with "STUDENT_REGISTERED_FOR_CLASS_SECTION_" and end with the ID of the offering. The value of the attribute will be true.
You can find the offering ID by opening the course to the Path page. If you have multiple Cohorts taking the course, be sure to open the Cohort you want to track. The class section ID will be in the URL.
The end of the URL will look something like this: /12345/path/.
So, in this case, the student would receive the attribute STUDENT_REGISTERED_FOR_CLASS_SECTION_12345
You can paste this under Account Settings (use the "Inject code into the body" section).
<!-- track custom attribute in Intercom for when student registers for class section -->
<script>
document.addEventListener("registration:created", function (e) {
// Grab the cohort ID from the event details
const cohortId = e.detail.cohort.id
const updates = {
// Include registration attribute
["student_registered_for_class_section_" + cohortId]: true
}
if (window.Intercom) {
// Add the attribute to the user in Intercom
window.Intercom("update", updates)
}
})
</script>
Track both the course ID and the Cohort ID
You can paste this custom code under Account Settings (use the "Inject code into the body" section).
<!-- track custom attribute in Intercom for when student registers for course and class section -->
<script>
document.addEventListener("registration:created", function (e) {
// Grab the cohort and resource IDs from the event details
const resourceId = e.detail.resource.id
const cohortId = e.detail.cohort.id
const updates = {
// Include registration attributes
["student_registered_for_course_" + resourceId]: true,
["student_registered_for_class_section_" + cohortId]: true
}
if (window.Intercom) {
// Add the attribute to the user in Intercom
window.Intercom("update", updates)
}
})
</script>
Track enrollment dates
To get the value of the current date with the enrollment, include this script.
updates["student_registered_for_course_" + e.detail.resource.id] + "_at" = Math.floor(Date.now() / 1000)