mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 08:58:41 +00:00
Website: add Segment analytics (#20867)
Related to: https://github.com/fleetdm/confidential/issues/7339 Changes: - Added a script tag for segment - Added segment tracking for contact form submissions, signups, and swag requests.
This commit is contained in:
parent
d16f0e085e
commit
fa529e47f9
8 changed files with 72 additions and 10 deletions
1
website/assets/.eslintrc
vendored
1
website/assets/.eslintrc
vendored
|
|
@ -49,6 +49,7 @@
|
|||
"docsearch": true,
|
||||
"Chart": true,
|
||||
"gtag": true,
|
||||
"analytics": true,
|
||||
// ...etc.
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
|
|
|
|||
6
website/assets/js/pages/contact.page.js
vendored
6
website/assets/js/pages/contact.page.js
vendored
|
|
@ -86,6 +86,9 @@ parasails.registerPage('contact', {
|
|||
if(typeof window.lintrk !== 'undefined') {
|
||||
window.lintrk('track', { conversion_id: 18587089 });// eslint-disable-line camelcase
|
||||
}
|
||||
if(typeof analytics !== 'undefined'){
|
||||
analytics.track('fleet_website__contact_forms');
|
||||
}
|
||||
// Show the success message.
|
||||
this.cloudSuccess = true;
|
||||
|
||||
|
|
@ -98,6 +101,9 @@ parasails.registerPage('contact', {
|
|||
if(typeof window.lintrk !== 'undefined') {
|
||||
window.lintrk('track', { conversion_id: 18587089 });// eslint-disable-line camelcase
|
||||
}
|
||||
if(typeof analytics !== 'undefined'){
|
||||
analytics.track('fleet_website__contact_forms');
|
||||
}
|
||||
if(this.formData.numberOfHosts > 700){
|
||||
this.goto(`https://calendly.com/fleetdm/talk-to-us?email=${encodeURIComponent(this.formData.emailAddress)}&name=${encodeURIComponent(this.formData.firstName+' '+this.formData.lastName)}`);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -39,7 +39,31 @@ parasails.registerPage('new-license', {
|
|||
// ║ ║╠╣ ║╣ ║ ╚╦╝║ ║ ║╣
|
||||
// ╩═╝╩╚ ╚═╝╚═╝ ╩ ╚═╝╩═╝╚═╝
|
||||
beforeMount: function() {
|
||||
//…
|
||||
if(window.location.hash) {
|
||||
if(typeof analytics !== 'undefined') {
|
||||
if(window.location.hash === '#signup') {
|
||||
analytics.identify(this.me.id, {
|
||||
email: this.me.emailAddress,
|
||||
firstName: this.me.firstName,
|
||||
lastName: this.me.lastName,
|
||||
company: this.me.organization,
|
||||
primaryBuyingSituation: this.me.primaryBuyingSituation,
|
||||
psychologicalStage: this.me.psychologicalStage,
|
||||
});
|
||||
analytics.track('fleet_website__sign_up');
|
||||
} else if(window.location.hash === '#login') {
|
||||
analytics.identify(this.me.id, {
|
||||
email: this.me.emailAddress,
|
||||
firstName: this.me.firstName,
|
||||
lastName: this.me.lastName,
|
||||
company: this.me.organization,
|
||||
primaryBuyingSituation: this.me.primaryBuyingSituation,
|
||||
psychologicalStage: this.me.psychologicalStage,
|
||||
});
|
||||
}
|
||||
}
|
||||
window.location.hash = '';
|
||||
}
|
||||
},
|
||||
mounted: async function() {
|
||||
|
||||
|
|
|
|||
|
|
@ -229,6 +229,9 @@ parasails.registerPage('basic-documentation', {
|
|||
if(typeof window.lintrk !== 'undefined') {
|
||||
window.lintrk('track', { conversion_id: 18587105 });// eslint-disable-line camelcase
|
||||
}
|
||||
if(typeof analytics !== 'undefined'){
|
||||
analytics.track('fleet_website__swag_request');
|
||||
}
|
||||
this.goto('https://kqphpqst851.typeform.com/to/ZfA3sOu0');
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ parasails.registerPage('login', {
|
|||
showCustomerLogin: true,
|
||||
// For redirecting users coming from the "Get your license" link to the license dispenser.
|
||||
registerSlug: '/register',
|
||||
pageToRedirectToAfterLogin: '/start',
|
||||
pageToRedirectToAfterLogin: '/start#login',
|
||||
},
|
||||
|
||||
// ╦ ╦╔═╗╔═╗╔═╗╦ ╦╔═╗╦ ╔═╗
|
||||
|
|
@ -41,7 +41,7 @@ parasails.registerPage('login', {
|
|||
// If we're redirecting this user to the license dispenser after they log in, modify the link to the /register page and the pageToRedirectToAfterLogin.
|
||||
if(window.location.hash && window.location.hash === '#purchaseLicense'){
|
||||
this.registerSlug = '/register#purchaseLicense';
|
||||
this.pageToRedirectToAfterLogin = '/new-license';
|
||||
this.pageToRedirectToAfterLogin = '/new-license#login';
|
||||
window.location.hash = '';
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ parasails.registerPage('signup', {
|
|||
showFullForm: false,
|
||||
// For redirecting users coming from the "Get your license" link to the license dispenser.
|
||||
loginSlug: '/login',
|
||||
pageToRedirectToAfterRegistration: '/start',
|
||||
pageToRedirectToAfterRegistration: '/start#signup',
|
||||
primaryBuyingSituation: undefined
|
||||
},
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ parasails.registerPage('signup', {
|
|||
// If we're redirecting this user to the license dispenser after they sign up, modify the link to the login page and the pageToRedirectToAfterRegistration
|
||||
if(window.location.hash && window.location.hash === '#purchaseLicense'){
|
||||
this.loginSlug = '/login#purchaseLicense';
|
||||
this.pageToRedirectToAfterRegistration = '/new-license';
|
||||
this.pageToRedirectToAfterRegistration = '/new-license#signup';
|
||||
window.location.hash = '';
|
||||
}
|
||||
},
|
||||
|
|
|
|||
25
website/assets/js/pages/start.page.js
vendored
25
website/assets/js/pages/start.page.js
vendored
|
|
@ -87,6 +87,31 @@ parasails.registerPage('start', {
|
|||
if(this.primaryBuyingSituation && _.isEmpty(this.formData['what-are-you-using-fleet-for'])){
|
||||
this.formData['what-are-you-using-fleet-for'] = {primaryBuyingSituation: this.primaryBuyingSituation};
|
||||
}
|
||||
if(window.location.hash) {
|
||||
if(typeof analytics !== 'undefined') {
|
||||
if(window.location.hash === '#signup') {
|
||||
analytics.identify(this.me.id, {
|
||||
email: this.me.emailAddress,
|
||||
firstName: this.me.firstName,
|
||||
lastName: this.me.lastName,
|
||||
company: this.me.organization,
|
||||
primaryBuyingSituation: this.me.primaryBuyingSituation,
|
||||
psychologicalStage: this.me.psychologicalStage,
|
||||
});
|
||||
analytics.track('fleet_website__sign_up');
|
||||
} else if(window.location.hash === '#login') {
|
||||
analytics.identify(this.me.id, {
|
||||
email: this.me.emailAddress,
|
||||
firstName: this.me.firstName,
|
||||
lastName: this.me.lastName,
|
||||
company: this.me.organization,
|
||||
primaryBuyingSituation: this.me.primaryBuyingSituation,
|
||||
psychologicalStage: this.me.psychologicalStage,
|
||||
});
|
||||
}
|
||||
}
|
||||
window.location.hash = '';
|
||||
}
|
||||
},
|
||||
mounted: async function() {
|
||||
//…
|
||||
|
|
|
|||
13
website/views/layouts/layout.ejs
vendored
13
website/views/layouts/layout.ejs
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue