Skip to content

Commit 95f2aa4

Browse files
authored
Integration with new site insights (#2777)
1 parent 9524ff5 commit 95f2aa4

29 files changed

+269
-111
lines changed

.bun-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.2.0
1+
1.2.1
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'gitbook': minor
3+
---
4+
5+
Track new events for site insights when ads are being clicked

bun.lock

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"devDependencies": {
77
"@changesets/cli": "^2.27.7",
88
"prettier": "^3.0.3",
9-
"turbo": "^2.1.2",
9+
"turbo": "^2.3.4",
1010
},
1111
},
1212
"packages/cache-do": {
@@ -32,7 +32,7 @@
3232
"name": "gitbook",
3333
"version": "0.5.0",
3434
"dependencies": {
35-
"@gitbook/api": "^0.88.1",
35+
"@gitbook/api": "^0.89.0",
3636
"@gitbook/cache-do": "workspace:*",
3737
"@gitbook/emoji-codepoints": "workspace:*",
3838
"@gitbook/icons": "workspace:*",
@@ -145,7 +145,7 @@
145145
"name": "@gitbook/react-contentkit",
146146
"version": "0.5.1",
147147
"dependencies": {
148-
"@gitbook/api": "^0.85.0",
148+
"@gitbook/api": "^0.89.0",
149149
"assert-never": "^1.2.1",
150150
"classnames": "^2.5.1",
151151
},
@@ -425,7 +425,7 @@
425425

426426
"@fortawesome/fontawesome-svg-core": ["@fortawesome/fontawesome-svg-core@6.6.0", "", { "dependencies": { "@fortawesome/fontawesome-common-types": "6.6.0" } }, "sha512-KHwPkCk6oRT4HADE7smhfsKudt9N/9lm6EJ5BVg0tD1yPA5hht837fB87F8pn15D8JfTqQOjhKTktwmLMiD7Kg=="],
427427

428-
"@gitbook/api": ["@gitbook/api@0.85.0", "", { "dependencies": { "event-iterator": "^2.0.0", "eventsource-parser": "^1.1.1" } }, "sha512-hhWFPxdX1zW8gQd7DYlf8R/LzaFWrC+jB9Lg4M4uz0Fcr5nrdbohufu1yMhGNNDTmo8qzv+fYyeTuoVJSV8G8A=="],
428+
"@gitbook/api": ["@gitbook/api@0.89.0", "", { "dependencies": { "event-iterator": "^2.0.0", "eventsource-parser": "^3.0.0" } }, "sha512-htzPY5OrFrZz29ShhB535e/j0Z6BBRDmdc97qfprJKzUE4zTRv2L20ZZ0dYeSgNFTkSiVhsuv0sfd6njWfNk7w=="],
429429

430430
"@gitbook/cache-do": ["@gitbook/cache-do@workspace:packages/cache-do"],
431431

@@ -1475,7 +1475,7 @@
14751475

14761476
"events-intercept": ["events-intercept@2.0.0", "", {}, "sha512-blk1va0zol9QOrdZt0rFXo5KMkNPVSp92Eju/Qz8THwKWKRKeE0T8Br/1aW6+Edkyq9xHYgYxn2QtOnUKPUp+Q=="],
14771477

1478-
"eventsource-parser": ["eventsource-parser@1.1.2", "", {}, "sha512-v0eOBUbiaFojBu2s2NPBfYUoRR9GjcDNvCXVaqEf5vVfpIAh9f8RCo4vXTP8c63QRKCFwoLpMpTdPwwhEKVgzA=="],
1478+
"eventsource-parser": ["eventsource-parser@3.0.0", "", {}, "sha512-T1C0XCUimhxVQzW4zFipdx0SficT651NnkR0ZSH3yQwh+mFMdLfgjABVi4YtMTtaL4s168593DaoaRLMqryavA=="],
14791479

14801480
"execa": ["execa@3.2.0", "", { "dependencies": { "cross-spawn": "^7.0.0", "get-stream": "^5.0.0", "human-signals": "^1.1.1", "is-stream": "^2.0.0", "merge-stream": "^2.0.0", "npm-run-path": "^4.0.0", "onetime": "^5.1.0", "p-finally": "^2.0.0", "signal-exit": "^3.0.2", "strip-final-newline": "^2.0.0" } }, "sha512-kJJfVbI/lZE1PZYDI5VPxp8zXPO9rtxOkhpZ0jMKha56AI9y2gGVC6bkukStQf0ka5Rh15BA5m7cCCH4jmHqkw=="],
14811481

@@ -2619,19 +2619,19 @@
26192619

26202620
"tslib": ["tslib@2.7.0", "", {}, "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA=="],
26212621

2622-
"turbo": ["turbo@2.1.3", "", { "optionalDependencies": { "turbo-darwin-64": "2.1.3", "turbo-darwin-arm64": "2.1.3", "turbo-linux-64": "2.1.3", "turbo-linux-arm64": "2.1.3", "turbo-windows-64": "2.1.3", "turbo-windows-arm64": "2.1.3" }, "bin": { "turbo": "bin/turbo" } }, "sha512-lY0yj2GH2a2a3NExZ3rGe+rHUVeFE2aXuRAue57n+08E7Z7N7YCmynju0kPC1grAQzERmoLpKrmzmWd+PNiADw=="],
2622+
"turbo": ["turbo@2.3.4", "", { "optionalDependencies": { "turbo-darwin-64": "2.3.4", "turbo-darwin-arm64": "2.3.4", "turbo-linux-64": "2.3.4", "turbo-linux-arm64": "2.3.4", "turbo-windows-64": "2.3.4", "turbo-windows-arm64": "2.3.4" }, "bin": { "turbo": "bin/turbo" } }, "sha512-1kiLO5C0Okh5ay1DbHsxkPsw9Sjsbjzm6cF85CpWjR0BIyBFNDbKqtUyqGADRS1dbbZoQanJZVj4MS5kk8J42Q=="],
26232623

2624-
"turbo-darwin-64": ["turbo-darwin-64@2.1.3", "", { "os": "darwin", "cpu": "x64" }, "sha512-ouJOm0g0YyoBuhmikEujVCBGo3Zr0lbSOWFIsQtWUTItC88F2w2byhjtsYGPXQwMlTbXwmoBU2lOCfWNkeEwHQ=="],
2624+
"turbo-darwin-64": ["turbo-darwin-64@2.3.4", "", { "os": "darwin", "cpu": "x64" }, "sha512-uOi/cUIGQI7uakZygH+cZQ5D4w+aMLlVCN2KTGot+cmefatps2ZmRRufuHrEM0Rl63opdKD8/JIu+54s25qkfg=="],
26252625

2626-
"turbo-darwin-arm64": ["turbo-darwin-arm64@2.1.3", "", { "os": "darwin", "cpu": "arm64" }, "sha512-j2FOJsK4LAOtHQlb3Oom0yWB/Vi0nF1ljInr311mVzHoFAJRZtfW2fRvdZRb/lBUwjSp8be58qWHzANIcrA0OA=="],
2626+
"turbo-darwin-arm64": ["turbo-darwin-arm64@2.3.4", "", { "os": "darwin", "cpu": "arm64" }, "sha512-IIM1Lq5R+EGMtM1YFGl4x8Xkr0MWb4HvyU8N4LNoQ1Be5aycrOE+VVfH+cDg/Q4csn+8bxCOxhRp5KmUflrVTQ=="],
26272627

2628-
"turbo-linux-64": ["turbo-linux-64@2.1.3", "", { "os": "linux", "cpu": "x64" }, "sha512-ubRHkI1gSel7H7wsmxKK8C9UlLWqg/2dkCC88LFupaK6TKgvBKqDqA0Z1M9C/escK0Jsle2k0H8bybV9OYIl4Q=="],
2628+
"turbo-linux-64": ["turbo-linux-64@2.3.4", "", { "os": "linux", "cpu": "x64" }, "sha512-1aD2EfR7NfjFXNH3mYU5gybLJEFi2IGOoKwoPLchAFRQ6OEJQj201/oNo9CDL75IIrQo64/NpEgVyZtoPlfhfA=="],
26292629

2630-
"turbo-linux-arm64": ["turbo-linux-arm64@2.1.3", "", { "os": "linux", "cpu": "arm64" }, "sha512-LffUL+e5wv7BtD6DgnM2kKOlDkMo2eRjhbAjVnrCD3wi2ug0tl6NDzajnHHjtaMyOnIf4AvzSKdLWsBxafGBQA=="],
2630+
"turbo-linux-arm64": ["turbo-linux-arm64@2.3.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-MxTpdKwxCaA5IlybPxgGLu54fT2svdqTIxRd0TQmpRJIjM0s4kbM+7YiLk0mOh6dGqlWPUsxz/A0Mkn8Xr5o7Q=="],
26312631

2632-
"turbo-windows-64": ["turbo-windows-64@2.1.3", "", { "os": "win32", "cpu": "x64" }, "sha512-S9SvcZZoaq5jKr6kA6eF7/xgQhVn8Vh7PVy5lono9zybvhyL4eY++y2PaLToIgL8G9IcbLmgOC73ExNjFBg9XQ=="],
2632+
"turbo-windows-64": ["turbo-windows-64@2.3.4", "", { "os": "win32", "cpu": "x64" }, "sha512-yyCrWqcRGu1AOOlrYzRnizEtdkqi+qKP0MW9dbk9OsMDXaOI5jlWtTY/AtWMkLw/czVJ7yS9Ex1vi9DB6YsFvw=="],
26332633

2634-
"turbo-windows-arm64": ["turbo-windows-arm64@2.1.3", "", { "os": "win32", "cpu": "arm64" }, "sha512-twlEo8lRrGbrR6T/ZklUIquW3IlFCEtywklgVA81aIrSBm56+GEVpSrHhIlsx1hiYeSNrs+GpDwZGe+V7fvEVQ=="],
2634+
"turbo-windows-arm64": ["turbo-windows-arm64@2.3.4", "", { "os": "win32", "cpu": "arm64" }, "sha512-PggC3qH+njPfn1PDVwKrQvvQby8X09ufbqZ2Ha4uSu+5TvPorHHkAbZVHKYj2Y+tvVzxRzi4Sv6NdHXBS9Be5w=="],
26352635

26362636
"type": ["type@2.7.3", "", {}, "sha512-8j+1QmAbPvLZow5Qpi6NCaN8FB60p/6x8/vfNqOk/hC+HuvFZhL4+WfekuhQLiqFZXOgQdrs3B+XxEmCc6b3FQ=="],
26372637

@@ -3163,8 +3163,6 @@
31633163

31643164
"fs-minipass/minipass": ["minipass@2.9.0", "", { "dependencies": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" } }, "sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg=="],
31653165

3166-
"gitbook/@gitbook/api": ["@gitbook/api@0.88.1", "", { "dependencies": { "event-iterator": "^2.0.0", "eventsource-parser": "^3.0.0" } }, "sha512-u+xzuWKbuTe25VTEiFEcZ49Jst8QCVrc6R7MycU4HnS3KKazuCk8gA30JU/JKINkUElMmPLsTOQPY3ZAYvPkVQ=="],
3167-
31683166
"glob/minimatch": ["minimatch@9.0.5", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow=="],
31693167

31703168
"google-auth-library/jws": ["jws@4.0.0", "", { "dependencies": { "jwa": "^2.0.0", "safe-buffer": "^5.0.1" } }, "sha512-KDncfTmOZoOMTFG4mBlG0qUIOlc03fmzH+ru6RgYVZhPkyiy/92Owlt/8UEN+a4TXR1FQetfIpJE8ApdvdVxTg=="],
@@ -3509,8 +3507,6 @@
35093507

35103508
"eslint/ajv/json-schema-traverse": ["json-schema-traverse@0.4.1", "", {}, "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="],
35113509

3512-
"gitbook/@gitbook/api/eventsource-parser": ["eventsource-parser@3.0.0", "", {}, "sha512-T1C0XCUimhxVQzW4zFipdx0SficT651NnkR0ZSH3yQwh+mFMdLfgjABVi4YtMTtaL4s168593DaoaRLMqryavA=="],
3513-
35143510
"glob/minimatch/brace-expansion": ["brace-expansion@2.0.1", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA=="],
35153511

35163512
"google-auth-library/jws/jwa": ["jwa@2.0.0", "", { "dependencies": { "buffer-equal-constant-time": "1.0.1", "ecdsa-sig-formatter": "1.0.11", "safe-buffer": "^5.0.1" } }, "sha512-jrZ2Qx916EA+fq9cEAeCROWPTfCwi1IVHqT2tapuqLEVVDKFDENFw1oL+MwrTvH6msKxsd1YTDVw6uKEcsrLEA=="],

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"devDependencies": {
55
"@changesets/cli": "^2.27.7",
66
"prettier": "^3.0.3",
7-
"turbo": "^2.1.2"
7+
"turbo": "^2.3.4"
88
},
99
"packageManager": "bun@1.1.18",
1010
"overrides": {

packages/gitbook/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"clean": "rm -rf ./.next && rm -rf ./public/~gitbook/static"
1717
},
1818
"dependencies": {
19-
"@gitbook/api": "^0.88.1",
19+
"@gitbook/api": "^0.89.0",
2020
"@gitbook/cache-do": "workspace:*",
2121
"@gitbook/emoji-codepoints": "workspace:*",
2222
"@gitbook/icons": "workspace:*",

packages/gitbook/src/app/middleware/(space)/~gitbook/pdf/page.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
RevisionPageDocument,
55
RevisionPageGroup,
66
SiteCustomizationSettings,
7+
SiteInsightsTrademarkPlacement,
78
Space,
89
} from '@gitbook/api';
910
import { Icon } from '@gitbook/icons';
@@ -146,7 +147,11 @@ export default async function PDFHTMLOutput(props: {
146147
limit={pdfParams.limit ?? DEFAULT_LIMIT}
147148
trademark={
148149
customization.trademark.enabled ? (
149-
<TrademarkLink space={space} customization={customization} />
150+
<TrademarkLink
151+
space={space}
152+
customization={customization}
153+
placement={SiteInsightsTrademarkPlacement.Footer}
154+
/>
150155
) : null
151156
}
152157
/>

packages/gitbook/src/components/Ads/Ad.tsx

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
'use client';
22

3-
import { SiteAds, SiteAdsStatus } from '@gitbook/api';
3+
import {
4+
SiteAds,
5+
SiteAdsStatus,
6+
SiteInsightsAdPlacement,
7+
SiteInsightsAd,
8+
SiteInsightsTrademarkPlacement,
9+
} from '@gitbook/api';
410
import * as React from 'react';
511

612
import { t, useLanguage } from '@/intl/client';
713
import { ClassValue, tcls } from '@/lib/tailwind';
814

915
import { renderAd } from './renderAd';
16+
import { useTrackEvent } from '../Insights';
17+
import { Link } from '../primitives';
1018

1119
/**
1220
* Zone ID provided by BuySellAds for the preview.
@@ -28,15 +36,28 @@ export function Ad({
2836
}: {
2937
zoneId: string | null;
3038
spaceId: string;
31-
placement: string;
39+
placement: SiteInsightsAdPlacement;
3240
ignore: boolean;
3341
style?: ClassValue;
3442
siteAdsStatus?: SiteAds['status'];
3543
mode?: 'classic' | 'auto' | 'cover';
3644
}) {
3745
const containerRef = React.useRef<HTMLDivElement>(null);
3846
const [visible, setVisible] = React.useState(false);
39-
const [ad, setAd] = React.useState<React.ReactNode | undefined>(undefined);
47+
const [ad, setAd] = React.useState<
48+
{ children: React.ReactNode; insightsAd: SiteInsightsAd | null } | undefined
49+
>(undefined);
50+
const trackEvent = useTrackEvent();
51+
52+
// Track display of the ad
53+
React.useEffect(() => {
54+
if (ad?.insightsAd) {
55+
trackEvent({
56+
type: 'ad_display',
57+
ad: ad.insightsAd,
58+
});
59+
}
60+
}, [ad]);
4061

4162
// Observe the container visibility
4263
React.useEffect(() => {
@@ -121,7 +142,7 @@ export function Ad({
121142
<div ref={containerRef} className={tcls(style)} data-visual-test="removed">
122143
{ad ? (
123144
<>
124-
{ad}
145+
{ad.children}
125146
<AdSponsoredLink spaceId={spaceId} />
126147
</>
127148
) : null}
@@ -132,6 +153,7 @@ export function Ad({
132153
function AdSponsoredLink(props: { spaceId: string }) {
133154
const { spaceId } = props;
134155
const language = useLanguage();
156+
const trackEvent = useTrackEvent();
135157

136158
const viaUrl = new URL('https://www.gitbook.com');
137159
viaUrl.searchParams.set('utm_source', 'content');
@@ -149,9 +171,17 @@ function AdSponsoredLink(props: { spaceId: string }) {
149171
'dark:text-light/5',
150172
)}
151173
>
152-
<a target="_blank" href={viaUrl.toString()} className={tcls('hover:underline')}>
174+
<Link
175+
target="_blank"
176+
href={viaUrl.toString()}
177+
className={tcls('hover:underline')}
178+
insights={{
179+
type: 'trademark_click',
180+
placement: SiteInsightsTrademarkPlacement.Ad,
181+
}}
182+
>
153183
{t(language, 'sponsored_via_gitbook')}
154-
</a>
184+
</Link>
155185
</p>
156186
);
157187
}

packages/gitbook/src/components/Ads/AdClassicRendering.tsx

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,38 @@
1+
import { SiteInsightsAd } from '@gitbook/api';
12
import * as React from 'react';
23

34
import { getResizedImageURL } from '@/lib/images';
45
import { tcls } from '@/lib/tailwind';
56

67
import { AdItem } from './types';
8+
import { Link } from '../primitives';
79

810
/**
911
* Classic rendering for an ad.
1012
*/
11-
export async function AdClassicRendering({ ad }: { ad: AdItem }) {
13+
export async function AdClassicRendering({
14+
ad,
15+
insightsAd,
16+
}: {
17+
ad: AdItem;
18+
insightsAd: SiteInsightsAd | null;
19+
}) {
1220
const smallImgSrc =
1321
'smallImage' in ad ? await getResizedImageURL(ad.smallImage, { width: 192, dpr: 2 }) : null;
1422
const logoSrc =
1523
'logo' in ad ? await getResizedImageURL(ad.logo, { width: 192 - 48, dpr: 2 }) : null;
1624
return (
17-
<a
25+
<Link
26+
rel="sponsored noopener"
27+
target="_blank"
28+
insights={
29+
insightsAd
30+
? {
31+
type: 'ad_click',
32+
ad: insightsAd,
33+
}
34+
: undefined
35+
}
1836
className={tcls(
1937
'flex',
2038
'flex-col',
@@ -29,8 +47,6 @@ export async function AdClassicRendering({ ad }: { ad: AdItem }) {
2947
'p-4',
3048
)}
3149
href={ad.statlink}
32-
rel="sponsored noopener"
33-
target="_blank"
3450
>
3551
{smallImgSrc && 'smallImage' in ad ? (
3652
<div>
@@ -47,6 +63,6 @@ export async function AdClassicRendering({ ad }: { ad: AdItem }) {
4763
<div className={tcls('flex', 'flex-col')}>
4864
<div className={tcls('text-xs')}>{ad.description}</div>
4965
</div>
50-
</a>
66+
</Link>
5167
);
5268
}

packages/gitbook/src/components/Ads/AdCoverRendering.tsx

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,37 @@
1+
import { SiteInsightsAd } from '@gitbook/api';
12
import * as React from 'react';
23

34
import { hexToRgba } from '@/lib/colors';
45
import { getResizedImageURL } from '@/lib/images';
56
import { tcls } from '@/lib/tailwind';
67

78
import { AdCover } from './types';
9+
import { Link } from '../primitives';
810

911
/**
1012
* Cover rendering for an ad.
1113
*/
12-
export async function AdCoverRendering({ ad }: { ad: AdCover }) {
14+
export async function AdCoverRendering({
15+
ad,
16+
insightsAd,
17+
}: {
18+
ad: AdCover;
19+
insightsAd: SiteInsightsAd | null;
20+
}) {
1321
const largeImage = await getResizedImageURL(ad.largeImage, { width: 128, dpr: 2 });
1422

1523
return (
16-
<a
24+
<Link
25+
rel="sponsored noopener"
26+
target="_blank"
27+
insights={
28+
insightsAd
29+
? {
30+
type: 'ad_click',
31+
ad: insightsAd,
32+
}
33+
: undefined
34+
}
1735
className={tcls(
1836
'group/ad',
1937
'relative',
@@ -33,8 +51,6 @@ export async function AdCoverRendering({ ad }: { ad: AdCover }) {
3351
)}
3452
style={{ backgroundColor: ad.backgroundColor, color: ad.textColor ?? '#ffffff' }}
3553
href={ad.statlink}
36-
rel="sponsored noopener"
37-
target="_blank"
3854
>
3955
<div
4056
className={tcls(
@@ -106,6 +122,6 @@ export async function AdCoverRendering({ ad }: { ad: AdCover }) {
106122
backgroundColor: hexToRgba(ad.backgroundColor, 0.8),
107123
}}
108124
/>
109-
</a>
125+
</Link>
110126
);
111127
}

packages/gitbook/src/components/Ads/renderAd.tsx

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use server';
22

3+
import { SiteInsightsAd, SiteInsightsAdPlacement } from '@gitbook/api';
34
import { headers } from 'next/headers';
45

56
import { AdClassicRendering } from './AdClassicRendering';
@@ -20,7 +21,7 @@ interface FetchLiveAdOptions {
2021
/** Mode to render the Ad */
2122
mode: 'classic' | 'auto' | 'cover';
2223
/** Name of the placement for the ad */
23-
placement: string;
24+
placement: SiteInsightsAdPlacement;
2425
/** If true, we'll not track it as an impression */
2526
ignore: boolean;
2627
}
@@ -47,16 +48,28 @@ export async function renderAd(options: FetchAdOptions) {
4748

4849
const { ad } = result;
4950

50-
return (
51-
<>
52-
{mode === 'classic' || !('callToAction' in ad) ? (
53-
<AdClassicRendering ad={ad} />
54-
) : (
55-
<AdCoverRendering ad={ad} />
56-
)}
57-
{ad.pixel ? <AdPixels rawPixel={ad.pixel} /> : null}
58-
</>
59-
);
51+
const insightsAd: SiteInsightsAd | null =
52+
options.source === 'live'
53+
? {
54+
placement: options.placement,
55+
zoneId: options.zoneId,
56+
domain: 'company' in ad ? ad.company : '',
57+
}
58+
: null;
59+
60+
return {
61+
children: (
62+
<>
63+
{mode === 'classic' || !('callToAction' in ad) ? (
64+
<AdClassicRendering ad={ad} insightsAd={insightsAd} />
65+
) : (
66+
<AdCoverRendering ad={ad} insightsAd={insightsAd} />
67+
)}
68+
{ad.pixel ? <AdPixels rawPixel={ad.pixel} /> : null}
69+
</>
70+
),
71+
insightsAd,
72+
};
6073
}
6174

6275
async function fetchAd({

0 commit comments

Comments
 (0)