Skip to content

Commit

Permalink
feat: 追蹤看更多 experience 的數據 (#1449)
Browse files Browse the repository at this point in the history
Co-authored-by: Yen-chi Chen <[email protected]>
  • Loading branch information
barry800414 and mark86092 authored Nov 7, 2024
1 parent 578a277 commit 42d3551
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ const ExperienceEntry = ({
},
size,
canView,
onClick,
}) => (
<div className={cn(styles.container, styles[size])}>
<div className={cn(styles.container, styles[size])} onClick={onClick}>
<Link to={createLinkTo({ id, pageType })}>
<section className={styles.contentWrapper}>
<div className={styles.labels}>
Expand Down Expand Up @@ -110,12 +111,14 @@ ExperienceEntry.propTypes = {
}),
).isRequired,
}).isRequired,
onClick: PropTypes.func,
pageType: PropTypes.string,
size: PropTypes.oneOf(['s', 'm', 'l']),
};

ExperienceEntry.defaultProps = {
size: 'm',
onClick: null,
};

export default ExperienceEntry;
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ const ExperienceEntry = ({
},
size,
canView,
onClick,
}) => (
<div className={cn(styles.container, styles[size])}>
<div className={cn(styles.container, styles[size])} onClick={onClick}>
<Link to={createLinkTo({ id, pageType })}>
<section className={styles.contentWrapper}>
<div className={styles.labels}>
Expand Down Expand Up @@ -136,12 +137,14 @@ ExperienceEntry.propTypes = {
).isRequired,
week_work_time: PropTypes.number,
}).isRequired,
onClick: PropTypes.func,
pageType: PropTypes.string.isRequired,
size: PropTypes.oneOf(['s', 'm', 'l']),
};

ExperienceEntry.defaultProps = {
size: 'm',
onClick: null,
};

export default ExperienceEntry;
8 changes: 8 additions & 0 deletions src/components/ExperienceDetail/MoreExperiencesBlock/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ import PropTypes from 'prop-types';
import InterviewExperienceEntry from '../../CompanyAndJobTitle/InterviewExperiences/ExperienceEntry';
import WorkExperienceEntry from '../../CompanyAndJobTitle/WorkExperiences/ExperienceEntry';
import { useLocation } from 'react-router';
import ReactGA from 'react-ga4';
import usePermission from 'hooks/usePermission';
import {
queryRelatedExperiencesOnExperience,
loadMoreRelatedExperiences,
} from 'actions/experience';
import { relatedExperiencesStateSelector } from 'selectors/experienceSelector';
import { pageType as PAGE_TYPE } from 'constants/companyJobTitle';
import { GA_CATEGORY, GA_ACTION } from 'constants/gaConstants';
import Button from 'common/button/Button';
import styles from './MoreExperiencesBlock.module.css';

Expand Down Expand Up @@ -84,6 +86,12 @@ const MoreExperiencesBlock = ({ experience }) => {
pageType={pageType}
data={e}
canView={canViewPublishId(e.id)}
onClick={() => {
ReactGA.event({
category: GA_CATEGORY.READ_MORE,
action: GA_ACTION.CLICK_READ_MORE_EXPERIENCE,
});
}}
/>
))}
{hasMore && <LoadMoreButton onClick={handleLoadMore} />}
Expand Down
2 changes: 2 additions & 0 deletions src/constants/gaConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const GA_CATEGORY = {
TEST_NEW_FEATURE: 'test_new_feature',
JOB_TITLE_PAGE: 'job_title_page',
COMPANY_PAGE: 'company_page',
READ_MORE: 'read_more',
};

export const GA_ACTION = {
Expand All @@ -35,4 +36,5 @@ export const GA_ACTION = {
CLICK_PRIVATE_MESSAGE_BUTTON: 'click_private_message_button',
SEARCH_COMPANY: 'search_company',
SEARCH_JOB_TITLE: 'search_job_title',
CLICK_READ_MORE_EXPERIENCE: 'click_read_more_experience',
};

0 comments on commit 42d3551

Please sign in to comment.