Differentiate job applicants etc from demo requests (#38132)

Co-authored-by: Eric <eashaw@sailsjs.com>
This commit is contained in:
Mike McNeil
2026-01-09 16:14:34 -06:00
committed by GitHub
co-authored by Eric
parent bb86c2d510
commit 0b0a81c2e6
3 changed files with 34 additions and 11 deletions
@@ -66,7 +66,10 @@ module.exports = {
},
success: {
decription: 'A user successfully submitted the "Talk to us" form.',
outputType: 'string',
outputType: {
icp: 'boolean',
eventUrl: 'string',
},
}
},
@@ -85,22 +88,26 @@ module.exports = {
lastName: lastName,
// organization: organization, // Note: the user-provided organization is not used here because we're relying on the enrichment helper below to find the correct organization for this person.
primaryBuyingSituation: primaryBuyingSituation === 'security-misc' ? 'Endpoint operations - Security' : primaryBuyingSituation === 'it-misc' ? 'Endpoint operations - IT' : primaryBuyingSituation === 'it-major-mdm' ? 'Device management (MDM)' : primaryBuyingSituation === 'it-gap-filler-mdm' ? 'IT - Gap-filler MDM' : primaryBuyingSituation === 'security-vm' ? 'Vulnerability management' : undefined,
contactSource: 'Website - Contact forms',
psychologicalStage: '4 - Has use case',
psychologicalStageChangeReason: 'Website - Contact forms'
};
// If the user said they have 700+ hosts, Update/create a contact and account, and send them to the "Talk to us" Calendly event.
if(numberOfHosts >= 700){
contactInformation.contactSource = 'Website - Contact forms - Demo - ICP';
contactInformation.description = `Submitted the "Talk to us" form and was taken to the Calendly page for the "Talk to us" event. Provided organization name: ${organization}, Number of hosts: ${numberOfHosts}`;
sails.helpers.salesforce.updateOrCreateContactAndAccount.with(contactInformation).exec((err)=>{
if(err) {
sails.log.warn(`Background task failed: When a user submitted the "Talk to us" form, a lead/contact could not be updated in the CRM for this email address: ${emailAddress}.`, err);
}
});
return `https://calendly.com/fleetdm/talk-to-us?email=${encodeURIComponent(emailAddress)}&name=${encodeURIComponent(firstName+' '+lastName)}`;
return {
icp: true,
eventUrl: `https://calendly.com/fleetdm/talk-to-us?email=${encodeURIComponent(emailAddress)}&name=${encodeURIComponent(firstName+' '+lastName)}`
};
} else {
// If the user has <700 hosts, use the get-enriched helper to try to find the number of employees at their organization.
let enrichmentInformation = await sails.helpers.iq.getEnriched.with({
emailAddress,
firstName,
@@ -112,22 +119,30 @@ module.exports = {
// If we got a employer.numberOfEmployees value from the getEnriched helper, send the user to the "talk to us" calendly event if it is 700+.
if(enrichmentInformation.employer && enrichmentInformation.employer.numberOfEmployees && enrichmentInformation.employer.numberOfEmployees >= 700) {
contactInformation.contactSource = 'Website - Contact forms - Demo - ICP';
contactInformation.description = `Submitted the "Talk to us" form and was taken to the Calendly page for the "Talk to us" event because of the number of employees (${enrichmentInformation.employer.numberOfEmployees}) returned by Coresignal. Provided organization name: ${organization}, Number of hosts: ${numberOfHosts}`;
sails.helpers.salesforce.updateOrCreateContactAndAccount.with(contactInformation).exec((err)=>{
if(err) {
sails.log.warn(`Background task failed: When a user submitted the "Talk to us" form, a lead/contact could not be updated in the CRM for this email address: ${emailAddress}.`, err);
}
});
return `https://calendly.com/fleetdm/talk-to-us?email=${encodeURIComponent(emailAddress)}&name=${encodeURIComponent(firstName+' '+lastName)}`;
return {
icp: true,
eventUrl:`https://calendly.com/fleetdm/talk-to-us?email=${encodeURIComponent(emailAddress)}&name=${encodeURIComponent(firstName+' '+lastName)}`
};
} else {
// If the enrichment helper didn't return a employer.numberOfEmployees value and this user has <700 hosts, send them to the "Let's get you set up!" Calendly event
// If the enrichment helper didn't return a employer.numberOfEmployees value and this user has <700 hosts, send them to the "Let's get you set up!" Calendly event
contactInformation.contactSource = 'Website - Contact forms - Demo';
contactInformation.description = `Submitted the "Talk to us" form and was taken to the Calendly page for the "Let\'s get you set up!" event. Provided organization name: ${organization}, Number of hosts: ${numberOfHosts}`;
sails.helpers.salesforce.updateOrCreateContactAndAccount.with(contactInformation).exec((err)=>{
if(err) {
sails.log.warn(`Background task failed: When a user submitted the "Talk to us" form, a lead/contact could not be updated in the CRM for this email address: ${emailAddress}.`, err);
}
});
return `https://calendly.com/fleetdm/chat?email=${encodeURIComponent(emailAddress)}&name=${encodeURIComponent(firstName+' '+lastName)}`;
return {
icp: false,
eventUrl: `https://calendly.com/fleetdm/chat?email=${encodeURIComponent(emailAddress)}&name=${encodeURIComponent(firstName+' '+lastName)}`
};
}
}
}
@@ -39,6 +39,8 @@ module.exports = {
type: 'string',
isIn: [
'Website - Contact forms',
'Website - Contact forms - Demo',
'Website - Contact forms - Demo - ICP',
'Website - Sign up',
'Website - Newsletter',
'LinkedIn - Comment',
+11 -5
View File
@@ -97,15 +97,21 @@ parasails.registerPage('contact', {
},
handleSubmittingTalkToUsForm: async function(argins) {
this.syncing = true;
if(typeof gtag !== 'undefined'){
gtag('event','fleet_website__contact_forms');
}
if(typeof window.lintrk !== 'undefined') {
window.lintrk('track', { conversion_id: 18587089 });// eslint-disable-line camelcase
}
let eventUrl = await Cloud.deliverTalkToUsFormSubmission.with(argins);
let report = await Cloud.deliverTalkToUsFormSubmission.with(argins);
this.goto(eventUrl);
if(typeof gtag !== 'undefined'){
// Look at result from talking to api and decide what event to track.
if(report.icp){
gtag('event','fleet_website__contact_forms__demo');
} else {
gtag('event','fleet_website__contact_forms__demo__icp');
}
}
this.goto(report.eventUrl);
},
clickSwitchForms: function(form) {