Skip to content

Commit 421ce61

Browse files
committed
fix: GTM
1 parent 3ff27f7 commit 421ce61

27 files changed

+39
-277
lines changed

public/img/icons-raw/icon-exit-small.svg

-4
This file was deleted.

public/img/icons/icon-exit-small.svg

-1
This file was deleted.

src/components/atoms/activeLink.tsx

-6
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,12 @@ import { LinkProps } from 'next/link';
33
import { useRouter } from 'next/router';
44
import React, { ReactElement } from 'react';
55

6-
import { analytics } from '../../lib/analytics';
76
import Link from './linkWithoutPrefetch';
87

98
type ActiveLinkProps = LinkProps & {
109
children: ReactElement;
1110
className?: string;
1211
activeClassName: string;
13-
linkLabel?: string;
1412
};
1513

1614
// SOURCE: https://zaiste.net/programming/reactjs/howtos/create-activelink-nextjs/
@@ -19,7 +17,6 @@ const ActiveLink = ({
1917
children,
2018
className,
2119
activeClassName,
22-
linkLabel,
2320
...props
2421
}: ActiveLinkProps): JSX.Element => {
2522
const { asPath } = useRouter();
@@ -34,9 +31,6 @@ const ActiveLink = ({
3431
<a
3532
className={clsx(className, isActive && activeClassName)}
3633
aria-current={isActive ? 'page' : false}
37-
onClick={() => {
38-
analytics.track('Menu click', { label: linkLabel });
39-
}}
4034
>
4135
{children}
4236
</a>

src/components/atoms/titleLogger.tsx

-31
This file was deleted.

src/components/molecules/buttonFavorite.tsx

+6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { BaseColors } from '~lib/constants';
55
import IconLike from '~public/img/icons/icon-like.svg';
66
import IconLikeActive from '~public/img/icons/icon-like-active.svg';
77
import IconLikeLight from '~public/img/icons/icon-like-light.svg';
8+
import { gtmPushEvent } from '~src/utils/gtm';
89

910
import { analytics } from '../../lib/analytics';
1011
import { isBackgroundColorDark } from './buttonPlay';
@@ -68,6 +69,11 @@ const ButtonFavorite = forwardRef<HTMLButtonElement, Props>(
6869
e.preventDefault();
6970
e.stopPropagation();
7071
toggleFavorited();
72+
if (!isFavorited) {
73+
gtmPushEvent({
74+
event: 'favorite',
75+
});
76+
}
7177
if (favoritedType) {
7278
analytics.track(isFavorited ? 'Unfavorite' : 'Favorite', {
7379
type: favoritedType,

src/components/molecules/buttonShare.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default function ButtonShare({
4040

4141
// FUTURE: update sharing links
4242
const facebookLink = `https://facebook.com/share.php?u=${shareUrl}`;
43-
const twitterLink = `https://twitter.com/intent/tweet?url=${shareUrl}`;
43+
const twitterLink = `https://x.com/intent/post?url=${shareUrl}`;
4444
const emailLink = `mailto:?body=${shareUrl}${
4545
emailSubject
4646
? `&subject=${encodeURIComponent(

src/components/molecules/card/collection.tsx

-11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import clsx from 'clsx';
22
import Image from 'next/legacy/image';
3-
import router from 'next/router';
43
import React from 'react';
54
import { FormattedMessage } from 'react-intl';
65

@@ -16,7 +15,6 @@ import { useFormattedDuration } from '~lib/time';
1615
import useHover from '~lib/useHover';
1716
import SuccessIcon from '~public/img/icons/icon-success-light.svg';
1817
import { CollectionContentType } from '~src/__generated__/graphql';
19-
import { analytics } from '~src/lib/analytics';
2018

2119
import ButtonFavorite from '../buttonFavorite';
2220
import CollectionTypeLockup from '../collectionTypeLockup';
@@ -52,7 +50,6 @@ export default function CardCollection({
5250
image,
5351
startDate,
5452
title,
55-
id,
5653
} = collection;
5754
const heroImage = image?.url && (
5855
<div className={styles.imageContainer}>
@@ -77,14 +74,6 @@ export default function CardCollection({
7774
isBibleVersion && styles.bibleVersion,
7875
(isHovered || isSubHovered) && styles.otherHovered,
7976
)}
80-
onClick={() => {
81-
analytics.track('Card click', {
82-
type: contentType,
83-
id,
84-
title,
85-
});
86-
router.push(canonicalPath);
87-
}}
8877
>
8978
<CollectionTypeLockup contentType={contentType} />
9079
{heroImage}

src/components/molecules/card/person.tsx

+2-13
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import RoundImage from '~components/atoms/roundImage';
1010
import Card from '~components/molecules/card';
1111
import { useIsPersonFavorited } from '~lib/api/useIsPersonFavorited';
1212
import { BaseColors } from '~lib/constants';
13-
import { CatalogEntityType } from '~src/__generated__/graphql';
14-
import { analytics } from '~src/lib/analytics';
1513

1614
import ButtonFavorite from '../buttonFavorite';
1715
import PersonTypeLockup from '../personTypeLockup';
@@ -35,21 +33,12 @@ export default function CardPerson({
3533
smallinit = false,
3634
}: CardCollectionProps): JSX.Element {
3735
const { isFavorited, toggleFavorited } = useIsPersonFavorited(person.id);
38-
const { canonicalPath, image, name, recordings, id } = person;
36+
const { canonicalPath, image, name, recordings } = person;
3937

4038
return (
4139
<Card className={clsx(compact && styles.compact)}>
4240
<Link href={canonicalPath} legacyBehavior>
43-
<a
44-
className={styles.container}
45-
onClick={() => {
46-
analytics.track('Card click', {
47-
type: CatalogEntityType.Person,
48-
id,
49-
title: name,
50-
});
51-
}}
52-
>
41+
<a className={styles.container}>
5342
<div className={styles.stretch}>
5443
{!compact && <PersonTypeLockup />}
5544
<Heading2 unpadded sans className={styles.title}>

src/components/molecules/card/sequence.tsx

+1-14
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import IconDisclosure from '~public/img/icons/icon-disclosure.svg';
2222
import SuccessIcon from '~public/img/icons/icon-success-light.svg';
2323
import { SequenceContentType } from '~src/__generated__/graphql';
2424
import NameMatcher from '~src/components/atoms/nameMatcher';
25-
import { analytics } from '~src/lib/analytics';
2625

2726
import ButtonFavorite from '../buttonFavorite';
2827
import PersonLockup from '../personLockup';
@@ -61,7 +60,6 @@ export default function CardSequence({
6160
title,
6261
speakers,
6362
sequenceWriters: writers,
64-
id,
6563
} = sequence;
6664

6765
const { Icon, accentColor, backgroundColor, textColor, label, labelColor } = (
@@ -302,18 +300,7 @@ export default function CardSequence({
302300
return (
303301
<Card>
304302
<Link href={linkUrl} legacyBehavior>
305-
<a
306-
className={className}
307-
onClick={() => {
308-
analytics.track('Card click', {
309-
type: sequence.contentType,
310-
id,
311-
title,
312-
});
313-
}}
314-
>
315-
{inner}
316-
</a>
303+
<a className={className}>{inner}</a>
317304
</Link>
318305
</Card>
319306
);

src/components/molecules/card/sponsor.tsx

+3-21
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import Card from '~components/molecules/card';
1010
import { useIsSponsorFavorited } from '~lib/api/useIsSponsorFavorited';
1111
import { BaseColors } from '~lib/constants';
1212
import UserPlusIcon from '~public/img/icons/fa-user-plus.svg';
13-
import { CatalogEntityType } from '~src/__generated__/graphql';
14-
import { analytics } from '~src/lib/analytics';
1513

1614
import ButtonFavorite from '../buttonFavorite';
1715
import TypeLockup from '../typeLockup';
@@ -28,29 +26,13 @@ export default function CardSponsor({
2826
const intl = useIntl();
2927
const { isFavorited, toggleFavorited } = useIsSponsorFavorited(sponsor.id);
3028

31-
const {
32-
canonicalPath,
33-
image,
34-
title,
35-
collections,
36-
sequences,
37-
recordings,
38-
id,
39-
} = sponsor;
29+
const { canonicalPath, image, title, collections, sequences, recordings } =
30+
sponsor;
4031

4132
return (
4233
<Card>
4334
<Link href={canonicalPath} legacyBehavior>
44-
<a
45-
className={styles.container}
46-
onClick={() => {
47-
analytics.track('Card click', {
48-
type: CatalogEntityType.Sponsor,
49-
id,
50-
title,
51-
});
52-
}}
53-
>
35+
<a className={styles.container}>
5436
<TypeLockup
5537
Icon={UserPlusIcon}
5638
label={intl.formatMessage({

src/components/molecules/navItem.tsx

-4
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import styles from '~components/organisms/navigation.module.scss';
66
import { INavigationItem } from '~lib/useNavigationItems';
77
import IconDisclosure from '~public/img/icons/icon-disclosure-light-small.svg';
88

9-
import { analytics } from '../../lib/analytics';
10-
119
export default function NavItem({
1210
item,
1311
setSubmenu,
@@ -31,15 +29,13 @@ export default function NavItem({
3129
href={href}
3230
className={styles.navLink}
3331
activeClassName={styles.active}
34-
linkLabel={label}
3532
>
3633
{inner}
3734
</ActiveLink>
3835
) : (
3936
<a
4037
className={styles.navLink}
4138
onClick={() => {
42-
analytics.track('Menu click', { label });
4339
setSubmenu(key);
4440
}}
4541
>

src/components/molecules/searchBar.module.scss

+3
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@
9292
letter-spacing: 0em;
9393
text-align: left;
9494
margin-left: 28px;
95+
@media (max-width: $breakpoint-sm) {
96+
display: none;
97+
}
9598
}
9699

97100
.filters {

src/components/molecules/searchBar.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export default function SearchBar({
7979
>
8080
<IconSearch width={24} height={24} />
8181
<input
82-
name="q"
82+
id="searchInput"
8383
type="search"
8484
autoComplete="off"
8585
value={term ?? ''}

src/components/molecules/teaseRecording.tsx

-13
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import Link from '~components/atoms/linkWithoutPrefetch';
88
import { AndMiniplayerFragment } from '~components/templates/__generated__/andMiniplayer';
99
import { BaseColors } from '~lib/constants';
1010

11-
import { analytics } from '../../lib/analytics';
1211
import { TeaseRecordingFragment } from './__generated__/teaseRecording';
1312
import ButtonAddToPlaylist from './buttonAddToPlaylist';
1413
import PlayButton from './buttonPlayCircle';
@@ -115,11 +114,6 @@ export default function TeaseRecording({
115114
unpadded && styles.unpadded,
116115
)}
117116
onClick={() => {
118-
analytics.track('Card click', {
119-
type: recording.recordingContentType,
120-
id: recording.id,
121-
title: recording.title,
122-
});
123117
router.push(recording.canonicalPath);
124118
}}
125119
>
@@ -133,13 +127,6 @@ export default function TeaseRecording({
133127
unpadded && styles.unpadded,
134128
fullBleed && styles.fullBleed,
135129
)}
136-
onClick={() => {
137-
analytics.track('Card click', {
138-
type: recording.recordingContentType,
139-
id: recording.id,
140-
title: recording.title,
141-
});
142-
}}
143130
>
144131
{inner}
145132
</a>

src/components/organisms/drawer.tsx

+1-9
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,9 @@ import styles from './drawer.module.scss';
1010
export default function Drawer({
1111
showingMenu,
1212
onExit,
13-
onSearchChange,
14-
searchTerm,
1513
}: {
1614
showingMenu: boolean;
1715
onExit: () => void;
18-
onSearchChange: (term: string | undefined) => void;
19-
searchTerm?: string;
2016
}): JSX.Element {
2117
useEffect(() => {
2218
Router.events.on('routeChangeStart', onExit);
@@ -34,11 +30,7 @@ export default function Drawer({
3430
<Header />
3531
</div>
3632
<div className={styles.navigation}>
37-
<Navigation
38-
onExit={onExit}
39-
searchTerm={searchTerm}
40-
onSearchChange={onSearchChange}
41-
/>
33+
<Navigation onExit={onExit} />
4234
</div>
4335
</div>
4436
);

0 commit comments

Comments
 (0)