Skip to content

Commit

Permalink
Merge branch 'develop' into feat/add-meta-tag-for-GA
Browse files Browse the repository at this point in the history
  • Loading branch information
olga-jwp committed Jul 6, 2023
2 parents c82012a + ca67ada commit 1240ca0
Show file tree
Hide file tree
Showing 10 changed files with 448 additions and 168 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# [4.23.0](https://github.com/jwplayer/ott-web-app/compare/v4.22.0...v4.23.0) (2023-07-06)


### Features

* av ([743af3e](https://github.com/jwplayer/ott-web-app/commit/743af3e4b855fed61178f2b8f52757edeb944e6f))
* code cleanup ([13a1e21](https://github.com/jwplayer/ott-web-app/commit/13a1e2120adf9486fb4e34b8544726811331c4c3))
* comment fix ([6ab4dcb](https://github.com/jwplayer/ott-web-app/commit/6ab4dcbff33f95539cbf8c20fc18b67976463f07))
* fix vite config definition ([2d772ed](https://github.com/jwplayer/ott-web-app/commit/2d772ed52ae835485fe48ffc4a0b3352ab9edcb5))
* oiid for analytics ([898f94a](https://github.com/jwplayer/ott-web-app/commit/898f94a6683dfcc18020deef90fc8a1bc987b6b3))
* update docs ([1fa1bcf](https://github.com/jwplayer/ott-web-app/commit/1fa1bcf093ff24514ead4e2a4ae943badf6f0871))



# [4.22.0](https://github.com/jwplayer/ott-web-app/compare/v4.21.0...v4.22.0) (2023-07-05)


Expand Down
12 changes: 6 additions & 6 deletions docs/features/video-analytics.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ These metrics are described below.

### App Metrics

| Name | Key | Rqd | Values | Example | Description |
| ----------------------- | ---- | --- | ------------------- | ---------------------------------------- | --------------------------------------------------- |
| App Version | av | Yes | A string | 1.0.0 | Version of the App |
| App Bundle ID | bun | Yes | Reverse domain name | com.apple.calculator | Unique ID to the App; persists through uninstalls. |
| App User ID | oaid | Yes | \[0-9a-z\]{40} | 51f8cf1797aac87ede45c2883797f124fed0258d | Hash of the app user account login ID. <sup>1</sub> |
| App Install Instance ID | oiid | No | \[0-9a-z\]{40} | 51f8cf1797aac87ede45c2883797f124fed0258d | App install instance ID. Resets with reinstalls |
| Name | Key | Rqd | Values | Example | Description |
| ------------- | ---- | --- | ------------------- | ---------------------------------------- | --------------------------------------------------- |
| App Version | av | Yes | A string | 1.0.0 | Version of the App |
| App Bundle ID | bun | Yes | Reverse domain name | com.apple.calculator | Unique ID to the App; persists through uninstalls. |
| App User ID | oaid | Yes | \[0-9a-z\]{40} | 51f8cf1797aac87ede45c2883797f124fed0258d | Hash of the app user account login ID. <sup>1</sub> |
| App Config ID | oiid | No | \[0-9a-z\]{8} | dGSUzs9o | Unique ID of app config. |

<sup>1</sup> For Cleeng `oaid` maps to the `subscriberId`

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jw-ott-webapp",
"version": "4.22.0",
"version": "4.23.0",
"main": "index.js",
"repository": "https://github.com/jwplayer/ott-web-app.git",
"author": "JW Player",
Expand Down Expand Up @@ -122,13 +122,13 @@
"tsconfig-paths": "^4.1.0",
"typescript": "^4.3.4",
"vi-fetch": "^0.8.0",
"vite": "4.2.0",
"vite": "^4.4.0",
"vite-plugin-eslint": "^1.8.1",
"vite-plugin-html": "^3.2.0",
"vite-plugin-pwa": "^0.14.0",
"vite-plugin-static-copy": "^0.13.0",
"vite-plugin-stylelint": "^4.0.1",
"vitest": "^0.25.7",
"vitest": "^0.32.3",
"workbox-build": "^6.5.4",
"workbox-window": "^6.5.4"
},
Expand Down
4 changes: 3 additions & 1 deletion public/jwpltx.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,15 @@ 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, av) {
uri = JSON.parse(JSON.stringify(URI));
uri.aid = aid;
uri.bun = bun;
uri.fed = fed;
uri.id = id;
uri.t = t;
uri.oiid = oiid;
uri.av = av;

// Send oaid only for logged in users
if (oaid) {
Expand Down
13 changes: 10 additions & 3 deletions src/hooks/useOttAnalytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,17 @@ 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;

// app version number (av)
const av = import.meta.env.APP_VERSION;

const [player, setPlayer] = useState<jwplayer.JWPlayer | null>(null);

useEffect(() => {
Expand All @@ -23,7 +30,7 @@ const useOttAnalytics = (item?: PlaylistItem, feedId: string = '') => {
};

const seekHandler = ({ offset }: jwplayer.SeekParam) => {
// TODO: according JWPlayer typings, the seek params doesn't contain a `duration` property, but it actually does
// TODO: according to JWPlayer typings, the seek param doesn't contain a `duration` property, but it actually does
window.jwpltx.seek(offset, player.getDuration());
};

Expand All @@ -38,7 +45,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, av);
};

const completeHandler = () => {
Expand Down Expand Up @@ -66,7 +73,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, av]);

return setPlayer;
};
Expand Down
2 changes: 1 addition & 1 deletion test-e2e/tests/payments/subscription_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ function runTestSuite(props: ProviderProps, providerName: string) {

I.see('Credit card');
I.see('PayPal');

I.see(props.paymentFields.creditCardholder);
I.see('Card number');
I.see('Expiry date');
I.see('Security code');
Expand Down
1 change: 1 addition & 0 deletions types/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ interface ImportMetaEnv {
readonly APP_PLAYER_LICENSE_KEY: string | undefined;
readonly APP_DEFAULT_LANGUAGE: string | undefined;
readonly APP_ENABLED_LANGUAGES: string | undefined;
readonly APP_VERSION: string | undefined;
readonly APP_GOOGLE_SITE_VERIFICATION_ID: string | undefined;
}

Expand Down
11 changes: 10 additions & 1 deletion types/jwpltx.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
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,
appversion?: string,
) => void;
adImpression: () => void;
seek: (offset: number, duration: number) => void;
seeked: () => void;
Expand Down
3 changes: 3 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ export default ({ mode, command }: ConfigEnv): UserConfigExport => {
targets: fileCopyTargets,
}),
],
define: {
'import.meta.env.APP_VERSION': JSON.stringify(process.env.npm_package_version),
},
publicDir: './public',
envPrefix: 'APP_',
server: {
Expand Down
Loading

0 comments on commit 1240ca0

Please sign in to comment.