Skip to content
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

screen_view & ad_impression are no longer reserved event names #2086

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
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
39 changes: 0 additions & 39 deletions src/components/Layout/GA4Toggle.tsx

This file was deleted.

8 changes: 6 additions & 2 deletions src/components/Layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
import { GAVersion, Url } from "../../constants"
import Spinner from "../Spinner"
import { linkData } from "./links"
import GA4Toggle from "./GA4Toggle"
import BugReport from "./BugReport"
import Loadable from "../Loadable"
import useLogin2, { UserStatus } from "./useLogin"
Expand Down Expand Up @@ -118,7 +117,7 @@
user,
}) => {
usePageView(title)
const { gaVersion, setGAVersion } = useGAVersion(pathname)

Check warning on line 120 in src/components/Layout/index.tsx

View workflow job for this annotation

GitHub Actions / build (18.x)

'setGAVersion' is assigned a value but never used

const [open, setOpen] = React.useState(false)

Expand All @@ -130,7 +129,12 @@
const newLocation = window.location.href.replace( window.location.hostname, newHostname );
window.location.replace(newLocation);
}
//}, 1000);

if( !window.location.search && window.location.pathname === '/' ) {
const newLocation = window.location.pathname = '/ga4/';
window.location.replace(newLocation);
}
//}, 1000);

return;
}, []);
Expand All @@ -149,7 +153,7 @@

return (
<div className={classes.root}>
<Helmet

Check failure on line 156 in src/components/Layout/index.tsx

View workflow job for this annotation

GitHub Actions / build (18.x)

'Helmet' cannot be used as a JSX component.

Check failure on line 156 in src/components/Layout/index.tsx

View workflow job for this annotation

GitHub Actions / build (18.x)

'Helmet' cannot be used as a JSX component.
htmlAttributes={{
lang: "en",
}}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Spinner.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from "react"
import { styled } from '@mui/material/styles';
import { useTheme } from "@mui/material"
import {Circles} from "react-loader-spinner"
import { Circles } from 'react-loader-spinner'
import {PropsWithChildren} from 'react';

const PREFIX = 'Spinner';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
// Event and required property mapping

export const eventDefinitions = {
"ad_impression": [],
"add_payment_info": ["value", "items"],
"add_shipping_info": ["value", "items"],
"add_to_cart": ["value", "items"],
"add_to_wishlist": ["value", "items"],
"begin_checkout": ["value", "items"],
"campaign_details": [],
"earn_virtual_currency": [],
"generate_lead": ["value"],
"join_group": [],
Expand Down
30 changes: 0 additions & 30 deletions src/components/ga4/EventBuilder/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,6 @@ const eventFor = (

const custom_event = eventFor(EventType.CustomEvent, [Category.Custom], [], [])

const ad_impression = eventFor(
EventType.AdImpression,
[Category.AllApps],
[
stringParam("ad_platform", "MoPub"),
stringParam("ad_source", "AdColony"),
stringParam("ad_format", "Banner"),
stringParam("ad_unit_name", "Banner_03"),
stringParam("currency", "USD"),
numberParam("value", 3.99),
]
)

const add_payment_info = eventFor(
EventType.AddPaymentInfo,
[Category.RetailEcommerce],
Expand Down Expand Up @@ -172,19 +159,6 @@ const begin_checkout = eventFor(
]
)

const campaign_details = eventFor(
EventType.CampaignDetails,
[Category.AllApps],
[
stringParam("campaign_id", "SUMMER_FUN"),
stringParam("campaign", "Summer_fun"),
stringParam("source", "google"),
stringParam("medium", "cpc"),
stringParam("term", "summer+travel"),
stringParam("content", "logolink"),
]
)

const earn_virtual_currency = eventFor(
EventType.EarnVirtualCurrency,
[Category.AllApps],
Expand Down Expand Up @@ -524,8 +498,6 @@ export const suggestedEventFor = (eventType: EventType): Event2 => {
case EventType.CustomEvent:
return custom_event

case EventType.AdImpression:
return ad_impression
case EventType.AddPaymentInfo:
return add_payment_info
case EventType.AddShippingInfo:
Expand All @@ -536,8 +508,6 @@ export const suggestedEventFor = (eventType: EventType): Event2 => {
return add_to_wishlist
case EventType.BeginCheckout:
return begin_checkout
case EventType.CampaignDetails:
return campaign_details
case EventType.EarnVirtualCurrency:
return earn_virtual_currency
case EventType.GenerateLead:
Expand Down
2 changes: 0 additions & 2 deletions src/components/ga4/EventBuilder/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,11 @@ export enum Category {

export enum EventType {
CustomEvent = "custom_event",
AdImpression = "ad_impression",
AddPaymentInfo = "add_payment_info",
AddShippingInfo = "add_shipping_info",
AddToCart = "add_to_cart",
AddToWishlist = "add_to_wishlist",
BeginCheckout = "begin_checkout",
CampaignDetails = "campaign_details",
EarnVirtualCurrency = "earn_virtual_currency",
GenerateLead = "generate_lead",
JoinGroup = "join_group",
Expand Down
Loading