Skip to content

Commit

Permalink
Website: update contact page personalization (#18332)
Browse files Browse the repository at this point in the history
Related to: #18099
Changes:
- Updated the contact page to show a different message depending on
answers a user provided in the /start questionnaire.
- For users who have Fleet deployed already: "Schedule a personalized
demo for your team and get support or training."
- For users who have tried Fleet and are ready to deploy: "Let us help
you deploy and evaluate Fleet quickly for yourself. We’d love to save
you some time."
  -
  • Loading branch information
eashaw authored Apr 16, 2024
1 parent b5c799b commit 2807bd6
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
1 change: 0 additions & 1 deletion website/api/controllers/view-contact.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ module.exports = {
// Respond with view.
return {
formToShow,
prefillFormDataFromUserRecord: this.req.me ? true : false// FUTURE: move to frontend.
};

}
Expand Down
23 changes: 21 additions & 2 deletions website/assets/js/pages/contact.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,16 @@ parasails.registerPage('contact', {
lastName: {required: true},
message: {required: false},
},

formDataToPrefillForLoggedInUsers: {},

// Server error state for the form
cloudError: '',

// Success state when form has been submitted
cloudSuccess: false,

// For personalizing the message at the top of the contact form.
buyingStage: undefined,
},

// ╦ ╦╔═╗╔═╗╔═╗╦ ╦╔═╗╦ ╔═╗
Expand All @@ -52,7 +54,7 @@ parasails.registerPage('contact', {
// Note: this will be overriden if the user is logged in and has a primaryBuyingSituation set in the database.
this.formData.primaryBuyingSituation = this.primaryBuyingSituation;
}
if(this.prefillFormDataFromUserRecord){// prefill from database
if(this.me){// prefill from database
this.formDataToPrefillForLoggedInUsers.emailAddress = this.me.emailAddress;
this.formDataToPrefillForLoggedInUsers.firstName = this.me.firstName;
this.formDataToPrefillForLoggedInUsers.lastName = this.me.lastName;
Expand All @@ -62,6 +64,23 @@ parasails.registerPage('contact', {
this.formDataToPrefillForLoggedInUsers.primaryBuyingSituation = this.me.primaryBuyingSituation;
}
this.formData = _.clone(this.formDataToPrefillForLoggedInUsers);
// If this user has submitted the /start questionnaire, determine their buying stage based on the answers they provided
if(!_.isEmpty(this.me.getStartedQuestionnaireAnswers)) {
let getStartedQuestionnaireAnswers = _.clone(this.me.getStartedQuestionnaireAnswers);
if(getStartedQuestionnaireAnswers['have-you-ever-used-fleet']) {
// If the user has Fleet deployed, then we'll assume they're stage five.
if(getStartedQuestionnaireAnswers['have-you-ever-used-fleet'].fleetUseStatus === 'yes-deployed' ||
getStartedQuestionnaireAnswers['have-you-ever-used-fleet'].fleetUseStatus === 'yes-recently-deployed') {
this.buyingStage = 'five';
}
}
if(getStartedQuestionnaireAnswers['what-did-you-think']){
// If this user has completed the "What did you think" step and wants to self-host Fleet, we'll assume theyre stage four.
if(getStartedQuestionnaireAnswers['what-did-you-think'].whatDidYouThink === 'deploy-fleet-in-environemnt'){
this.buyingStage = 'four';
}
}
}
}
if(window.location.search){// auto-clear query string (TODO: Document why we're doing this further. I think this shouldn't exist in the frontend code, instead in the hook. Because analytics corruption.)
window.history.replaceState({}, document.title, '/contact' );
Expand Down
4 changes: 3 additions & 1 deletion website/views/pages/contact.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
<div class="d-flex flex-lg-row flex-column justify-content-center">
<div purpose="form-container" v-if="!cloudSuccess">
<h2>Get in touch</h2>
<p>Schedule a personalized demo, or ask us anything. We’d love to chat.</p>
<p v-if="!buyingStage">Schedule a personalized demo, or ask us anything. We’d love to chat.</p>
<p v-else-if="buyingStage === 'four'">Let us help you deploy and evaluate Fleet quickly for yourself. We’d love to save you some time.</p>
<p v-else-if="buyingStage === 'five'">Schedule a personalized demo for your team and get support or training.</p>
<div purpose="contact-form-switch" class="d-flex flex-sm-row flex-column justify-content-center mx-auto">
<div purpose="switch-option" :class="[formToDisplay === 'talk-to-us' ? 'selected' : '']" @click="clickSwitchForms('talk-to-us')">Talk to us</div>
<div purpose="switch-option" :class="[formToDisplay === 'contact' ? 'selected' : '']" @click="clickSwitchForms('contact')">Send a message</div>
Expand Down

0 comments on commit 2807bd6

Please sign in to comment.