Skip to content

Commit 0c1b3c1

Browse files
committed
a/b v2 init
1 parent 6e1af03 commit 0c1b3c1

File tree

2 files changed

+30
-5
lines changed

2 files changed

+30
-5
lines changed

src/shared/containers/Gigs/RecruitCRMJobApply.jsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { withOptimizely } from '@optimizely/react-sdk';
1414
import techSkills from './techSkills';
1515

1616

17+
const cookies = require('browser-cookies');
1718
const countries = require('i18n-iso-countries');
1819
countries.registerLocale(require('i18n-iso-countries/langs/en.json'));
1920

@@ -129,6 +130,22 @@ class RecruitCRMJobApplyContainer extends React.Component {
129130
if (_.isEmpty(state.formErrors)) {
130131
applyForJob(job, formData);
131132
optimizely.track('Submit Application Form');
133+
const isFeatured = _.find(job.custom_fields, ['field_name', 'Featured']);
134+
const jobTags = _.find(job.custom_fields, ['field_name', 'Job Tag']);
135+
let hotListCookie = cookies.get('_tc.hcl');
136+
if (isFeatured && isFeatured.value) {
137+
optimizely.track('Submit to Featured Gigs');
138+
}
139+
if (jobTags && jobTags.value) {
140+
optimizely.track('Submit to Tagged Gigs');
141+
}
142+
if (hotListCookie) {
143+
hotListCookie = JSON.parse(hotListCookie);
144+
if (hotListCookie.slug === job.slug) {
145+
optimizely.track('Submit to Hotlist Gigs');
146+
cookies.erase('_tc.hcl');
147+
}
148+
}
132149
}
133150
});
134151
}

src/shared/containers/Gigs/RecruitCRMJobs.jsx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import { getQuery, updateQuery } from 'utils/url';
1919
import { withOptimizely } from '@optimizely/react-sdk';
2020
import './jobLisingStyles.scss';
2121

22+
const cookies = require('browser-cookies');
23+
2224
const CONTENT_PREVIEW_LENGTH = 175;
2325
const GIGS_PER_PAGE = 10;
2426
// Sort by dropdown
@@ -47,7 +49,7 @@ class RecruitCRMJobsContainer extends React.Component {
4749
this.onFilter = this.onFilter.bind(this);
4850
this.onLocation = this.onLocation.bind(this);
4951
this.onSort = this.onSort.bind(this);
50-
this.onHotlistApply = this.onHotlistApply.bind(this);
52+
this.onHotlistClick = this.onHotlistClick.bind(this);
5153
}
5254

5355
componentDidMount() {
@@ -121,9 +123,14 @@ class RecruitCRMJobsContainer extends React.Component {
121123
});
122124
}
123125

124-
onHotlistApply() {
126+
onHotlistClick(job) {
125127
const { optimizely } = this.props;
126128
optimizely.track('Hotlist ads click');
129+
cookies.set('_tc.hcl', JSON.stringify({
130+
slug: job.slug,
131+
}), {
132+
expires: 0,
133+
});
127134
}
128135

129136
render() {
@@ -151,7 +158,8 @@ class RecruitCRMJobsContainer extends React.Component {
151158
// optimizely decide
152159
let decision = { enabled: true };
153160
if (isomorphy.isClientSide()) {
154-
decision = optimizely.decide('gig_listing_hotlist');
161+
// decision = optimizely.decide('gig_listing_hotlist');
162+
decision = optimizely.decide('gig_listing_hotlist_center');
155163
}
156164
let jobsToDisplay = jobs;
157165
// build hotlist of jobs if present
@@ -244,7 +252,7 @@ class RecruitCRMJobsContainer extends React.Component {
244252
<div styleName="hotlist-items">
245253
{
246254
hotlistJobs.map((hjob, indx) => (indx <= 1 ? (
247-
<Link styleName={`hotlist-item-${indx + 1}`} to={`${config.GIGS_PAGES_PATH}/${hjob.slug}`} key={`hotlist-item-${indx + 1}`} onClick={this.onHotlistApply}>
255+
<Link styleName={`hotlist-item-${indx + 1}`} to={`${config.GIGS_PAGES_PATH}/${hjob.slug}`} key={`hotlist-item-${indx + 1}`} onClick={() => this.onHotlistClick(hjob)}>
248256
<div styleName="location"><IconBlackLocation /> {hjob.country}</div>
249257
<h5 styleName="job-title">{hjob.name}</h5>
250258
<div styleName="job-money">${hjob.min_annual_salary} - {hjob.max_annual_salary} / {getSalaryType(hjob.salary_type)}</div>
@@ -272,7 +280,7 @@ class RecruitCRMJobsContainer extends React.Component {
272280
</div>
273281
) : null
274282
}
275-
<Link styleName={`hotlist-item-button-${indx + 1}`} to={`${config.GIGS_PAGES_PATH}/${hjob.slug}`} onClick={this.onHotlistApply}>Apply Now</Link>
283+
<Link styleName={`hotlist-item-button-${indx + 1}`} to={`${config.GIGS_PAGES_PATH}/${hjob.slug}`} onClick={() => this.onHotlistClick(hjob)}>Apply Now</Link>
276284
</div>
277285
)))
278286
}

0 commit comments

Comments
 (0)