Update optional field event (#307)
This commit is contained in:
@@ -153,22 +153,11 @@ class RegistrationPage extends React.Component {
|
||||
return (
|
||||
<OptionalFields
|
||||
values={values}
|
||||
onChangeHandler={(fieldName, value) => this.optionalFieldOnChange(fieldName, value)}
|
||||
onChangeHandler={(fieldName, value) => { this.setState({ [fieldName]: value }); }}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
optionalFieldOnChange = (fieldName, value) => {
|
||||
this.setState({ [fieldName]: value });
|
||||
if (value) {
|
||||
window.optimizely = window.optimizely || [];
|
||||
window.optimizely.push({
|
||||
type: 'event',
|
||||
eventName: `van_504_${fieldName}`,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
handleInstitutionLogin = () => {
|
||||
this.setState(prevState => ({ institutionLogin: !prevState.institutionLogin }));
|
||||
}
|
||||
@@ -464,6 +453,14 @@ class RegistrationPage extends React.Component {
|
||||
type: 'event',
|
||||
eventName: 'van_504_conversion_rate',
|
||||
});
|
||||
['yearOfBirth', 'gender', 'levelOfEducation'].forEach(fieldName => {
|
||||
if (this.state[fieldName]) {
|
||||
window.optimizely.push({
|
||||
type: 'event',
|
||||
eventName: `van_504_${fieldName}`,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -72,6 +72,15 @@ const WelcomePage = (props) => {
|
||||
const handleSubmit = (e) => {
|
||||
e.preventDefault();
|
||||
fireOptimizelyEvent();
|
||||
window.optimizely = window.optimizely || [];
|
||||
['yearOfBirth', 'gender', 'levelOfEducation'].forEach(fieldName => {
|
||||
if (values[fieldName]) {
|
||||
window.optimizely.push({
|
||||
type: 'event',
|
||||
eventName: `van_504_${fieldName}`,
|
||||
});
|
||||
}
|
||||
});
|
||||
if (registrationResult.success) {
|
||||
window.location.href = registrationResult.redirectUrl;
|
||||
}
|
||||
@@ -87,13 +96,6 @@ const WelcomePage = (props) => {
|
||||
|
||||
const onChangeHandler = (e) => {
|
||||
setValues({ ...values, [e.target.name]: e.target.value });
|
||||
if (e.target.value) {
|
||||
window.optimizely = window.optimizely || [];
|
||||
window.optimizely.push({
|
||||
type: 'event',
|
||||
eventName: `van_504_${e.target.name}`,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user