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

Ab test rammeverk #353

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
Draft

Ab test rammeverk #353

wants to merge 12 commits into from

Conversation

thomaslund
Copy link

No description provided.

@@ -13,7 +13,7 @@
"lint-es": "eslint --cache --cache-location '.eslintcache/' --ext .js --ext .jsx --max-warnings=0 src e2e",
"format": "node prettier.js write",
"format-check": "node prettier.js lint",
"start": "razzle start --inspect --inspect-port 9230",
"start": "cross-env GOOGLE_APPLICATION_CREDENTIALS=./secrets.json razzle start --inspect --inspect-port 9230",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Denne env variabelen bør sikkert settes på en annen måte

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hvor brukes denne?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Denne brukes til å sette client og server secrets for autentisering mot Google analytics management API. Optimalt bør disse verdiene settes som env variabler i de forskjellige miljøene slik at vi slipper secrets.json

src/config.js Outdated
case 'dev':
// test IDs
return {
GOOGLE_ACCOUNT_ID: "74405776",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dette er en test konto for å verifisere under utvikling. Dette må konfigureres opp for de forskjellige miljøene.

experiments={experiments}
onVariantMount={({expId, expVar, isActiveExperiment}) => {
if(isActiveExperiment) {
window.ga('set', { expId, expVar }); // Perhaps get GA from ndla/tracker?
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tracking via GA er kanskje skilt ut i en pakke allerede?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ja, og abtest-pakken burde vel egentlig vært en del av ndla/tracker og ikke en egen pakke? Så burde man vel kanskje gjøre window.ga-funksjonene i Experiment / Variant komponenten?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bra innspill.

(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
window.ga('create', 'UA-74405776-4', 'auto');`
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oppretting av tracker er muligens håndtert annerledes i dag?

@@ -157,6 +158,11 @@ app.get('/lti', ndlaMiddleware, async (req, res) => {
handleRequest(req, res, ltiRoute);
});

app.get('/experiments', async (req, res) => {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Denne bør caches. Den vil hente experiments fra google management API. Har dere noen innspill?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vi bør vel legge den til i backenden et sted tipper jeg

Copy link
Contributor

@kodeebo kodeebo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Se kommentarer. Ser ut til å funke, men med SSR kræsjer det (500)

@@ -116,6 +117,7 @@
"sass-loader": "^7.1.0",
"serialize-javascript": "^1.5.0",
"source-map-support": "^0.5.9",
"universal-analytics": "^0.4.20",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ser ikke at denne er brukt noe sted?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Den skal jeg fjerne. Gammelt rusk som vi glemte å ta ut.

experiments={experiments}
onVariantMount={({expId, expVar, isActiveExperiment}) => {
if(isActiveExperiment) {
window.ga('set', { expId, expVar }); // Perhaps get GA from ndla/tracker?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ja, og abtest-pakken burde vel egentlig vært en del av ndla/tracker og ikke en egen pakke? Så burde man vel kanskje gjøre window.ga-funksjonene i Experiment / Variant komponenten?

@@ -69,5 +70,12 @@ export const routes = [
];

export default function(initialProps = {}, locale) {
return <App initialProps={initialProps} locale={locale} />;
return (
<ExperimentsContext.Provider
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bruken av ExperimentsContext er litt forvirrende. Nå brukes samme Context til to foskjellige providers, det virker ikke helt riktig. Ville definert en egen context her og importert den i stedet

const experimentId = 'OtejUgVLRHmGTAGv7jbFyA';

const MastheadMenuModal = ({ t, children }) => (
<ExperimentsContext.Consumer>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bruk useContext i stedet

@@ -27,8 +27,17 @@ const Document = ({ helmet, assets, data }) => {
rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,600,700|Source+Serif+Pro:400,700"
/>
{config.gaTrackingId && (
<script async src="https://www.google-analytics.com/analytics.js" />
{!config.gaTrackingId && (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skal det være '!'?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants