Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Send layout selected ga4 event
Send an event when a user explicitly clicks on the list or grid view
button selection.
  • Loading branch information
sarangj committed Feb 11, 2026
commit 16633d4188ac9966c89348eadb5fe07500de1895
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { sendLayoutSelectedEvent } from "@/src/utils/ga4Utils";
import { SearchManager } from "@/src/utils/searchManager/searchManager";
import {
Menu,
Expand Down Expand Up @@ -60,6 +61,7 @@ const ViewingOptionsMenu = ({
variant={searchManager.viewMode == "grid" ? "primary" : "text"}
aria-pressed={searchManager.viewMode == "grid" ? true : false}
onClick={() => {
sendLayoutSelectedEvent("Grid");
if (setFiltersExpanded) {
setFiltersExpanded(false);
}
Expand Down Expand Up @@ -88,6 +90,7 @@ const ViewingOptionsMenu = ({
variant={searchManager.viewMode == "list" ? "primary" : "text"}
aria-pressed={searchManager.viewMode == "list" ? true : false}
onClick={() => {
sendLayoutSelectedEvent("List");
if (setFiltersExpanded) {
setFiltersExpanded(false);
}
Expand Down
8 changes: 8 additions & 0 deletions app/src/utils/ga4Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ export const sendDownloadEvent = (
});
};

export const sendLayoutSelectedEvent = (viewMode: "Grid" | "List") => {
Comment thread
sarangj marked this conversation as resolved.
Outdated
const dataLayer = window["dataLayer"] || [];
dataLayer.push({
event: "select_layout",
layout_type: viewMode,
});
};

export const trackAVProgress = (
mediaType: string,
mediaName: string,
Expand Down