Using AnalyticsJS with Qualified

Andrew Sawusch Updated by Andrew Sawusch

The interactions that your team has with users within the Qualified messenger on your website can be used to trigger the AnalyticsJS Identify event. After inserting just a few lines of code, anytime a web visitor provides their email address into the Qualified messenger, the interaction will be used to deanonymize the user, and be recorded as an event that is viewable in your organization's my.CaliberMind reports.

Getting Started

A pre-requisite is that you must already have the AnalyticsJS installed on your website to ensure that the analytics.identify call is processed correctly.

*Note: The AnalyticsJS script should be deployed before the Qualified function and main Qualified Javascript code in the website <head> section

Once the AnalyticsJS is on your website, find out where your Qualified JavaScript code is located on your company's website. Some customers decide to place this directly into the site header, while others use Google Tag Manager.

Immediately after the qualified.js JavaScript code, place the following lines of code:

<script>
qualified('handleEvents', function(name, data) {
switch(name) {
case 'Email Captured': {
if (data && data.field_values) {
for (const [key, value] of Object.entries(data.field_values)) {
if (typeof value === "string" && /.+\@.+\..+/.test(value)) {
analytics.identify(value, { email: value });
break;
}
}
}
break;
}
default:
}
})
</script>

Once this has been added, your full lines of code should look something like this (with the "XXXXXXXXXXXX" being your Qualified account's unique account-specific code):

// This is the Qualified function
<script>
(function(w,q){w['QualifiedObject']=q;w[q]=w[q]||function(){
(w[q].q=w[q].q||[]).push(arguments)};})(window,'qualified')
</script>


// This is the main Qualified JS script
<script async="" src="https://js.qualified.com/qualified.js?token=XXXXXXXXXXXX"></script>


// This is the new function to add immediately after the Qualified JS script
<script>
qualified('handleEvents', function(name, data) {
switch(name) {
case 'Email Captured': {
if (data && data.field_values) {
for (const [key, value] of Object.entries(data.field_values)) {
if (typeof value === "string" && /.+\@.+\..+/.test(value)) {
analytics.identify(value, { email: value });
break;
}
}
}
break;
}
default:
}
})
</script>

After the code has been placed onto your website, contact your Qualified Success Architect or issue a support ticket with the Qualified Technical Support team - requesting that they "enable event handling on your account"

With this code added and event handling enabled, you will be able to trigger the AnalyticsJS "Identify" event any time that a website visitor enters their email address within your Qualified messenger.

How did we do?

How to check your AnalyticsJS implementation

Contact