-
Notifications
You must be signed in to change notification settings - Fork 1
Add posthog analytics #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| v12.13.1 | ||
| v24 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,12 +5,13 @@ import { useDispatch } from "react-redux"; | |
| import classNames from "classnames/bind"; | ||
| import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; | ||
| import { Link } from "react-router-dom"; | ||
| import { usePostHog } from "@posthog/react"; | ||
|
|
||
| // Reducers | ||
| import { pushToDataLayer } from "reducers/TagManagerReducer"; | ||
|
|
||
| // Helpers | ||
| import { getQueryStringFromFacets } from "helpers/FacetFilterHelpers"; | ||
| import { getActiveFiltersFromSelectedFacets, getQueryStringFromFacets } from "helpers/FacetFilterHelpers"; | ||
|
|
||
| // Components | ||
| import { ErrorBoundary } from "components/ErrorBoundary"; | ||
|
|
@@ -20,6 +21,7 @@ import style from "components/partials/FacetFilter/Facet.module.scss"; | |
|
|
||
| const Facet = (props) => { | ||
| const dispatch = useDispatch(); | ||
| const posthog = usePostHog(); | ||
|
|
||
| // State | ||
| const [checked, setChecked] = useState(false); | ||
|
|
@@ -139,6 +141,19 @@ const Facet = (props) => { | |
| facet: props.facet | ||
| }) | ||
| ); | ||
|
|
||
| const selectedFacets = props?.searchData?.selectedFacets || {}; | ||
| const activeFilters = getActiveFiltersFromSelectedFacets(selectedFacets); | ||
|
|
||
| posthog?.capture("facet_filter_applied", { | ||
| facet_field: props.facetField, | ||
| facet_field_name: props.facetFieldNameTranslated, | ||
| facet_name: props.facet.Name, | ||
| facet_name_translated: props.facet.NameTranslated, | ||
| facet_count: props.facet.Count, | ||
| action: checked ? "remove" : "add", | ||
| active_filters: activeFilters, | ||
| }); | ||
|
Comment on lines
+145
to
+156
|
||
| }; | ||
|
|
||
| const renderFacet = () => { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bumping
.nvmrcto Node v24 is likely incompatible with the current tooling stack (react-scripts@5.0.1/react-app-rewired), and may break local development and CI installs/builds. Please either keep the Node version aligned with what the toolchain supports, or update the build tooling to versions that explicitly support Node 24 and verify in CI.