diff --git a/public/jwpltx.js b/public/jwpltx.js index d515287dd..19014bba5 100644 --- a/public/jwpltx.js +++ b/public/jwpltx.js @@ -90,13 +90,14 @@ window.jwpltx = window.jwpltx || {}; } // Process a player ready event - o.ready = function (aid, bun, fed, id, t, oaid) { + o.ready = function (aid, bun, fed, id, t, oaid, oiid) { uri = JSON.parse(JSON.stringify(URI)); uri.aid = aid; uri.bun = bun; uri.fed = fed; uri.id = id; uri.t = t; + uri.oiid = oiid; // eslint-disable-next-line no-undef uri.av = APP_VERSION; diff --git a/src/hooks/useOttAnalytics.ts b/src/hooks/useOttAnalytics.ts index 4d39e8cc1..76317f8ce 100644 --- a/src/hooks/useOttAnalytics.ts +++ b/src/hooks/useOttAnalytics.ts @@ -7,10 +7,14 @@ import { useAccountStore } from '#src/stores/AccountStore'; const useOttAnalytics = (item?: PlaylistItem, feedId: string = '') => { const analyticsToken = useConfigStore((s) => s.config.analyticsToken); const user = useAccountStore((state) => state.user); + const { config } = useConfigStore((s) => s); // ott app user id (oaid) const oaid: number | undefined = user?.id ? Number(user.id) : undefined; + // app config id (oiid) + const oiid = config?.id; + const [player, setPlayer] = useState(null); useEffect(() => { @@ -38,7 +42,7 @@ const useOttAnalytics = (item?: PlaylistItem, feedId: string = '') => { return; } - window.jwpltx.ready(analyticsToken, window.location.hostname, feedId, item.mediaid, item.title, oaid); + window.jwpltx.ready(analyticsToken, window.location.hostname, feedId, item.mediaid, item.title, oaid, oiid); }; const completeHandler = () => { @@ -66,7 +70,7 @@ const useOttAnalytics = (item?: PlaylistItem, feedId: string = '') => { player.off('seeked', seekedHandler); player.off('adImpression', adImpressionHandler); }; - }, [player, item, analyticsToken, feedId, oaid]); + }, [player, item, analyticsToken, feedId, oaid, oiid]); return setPlayer; }; diff --git a/types/jwpltx.d.ts b/types/jwpltx.d.ts index f28fd073a..39dad7b62 100644 --- a/types/jwpltx.d.ts +++ b/types/jwpltx.d.ts @@ -1,5 +1,5 @@ interface Jwpltx { - ready: (analyticsid: string, hostname: string, feedid: string, mediaid: string, title: string, accountid?: number) => void; + ready: (analyticsid: string, hostname: string, feedid: string, mediaid: string, title: string, accountid?: number, appid?: string) => void; adImpression: () => void; seek: (offset: number, duration: number) => void; seeked: () => void;