To use the Datadog browser SDK in our application, we had to make some changes to the original repository. This was necessary to comply with GDPR and to ensure our users cannot be tracked across different pages.
Therefore, we decided to fork the original repository and apply the changes there. This document describes the steps to upgrade the forked repository to the latest version of the original repository.
-
Install webpack globally. It should match the version in the project. Otherwise, the build might fail 😞
npm install -g webpack@<webpack_version_used_by_sdk> npm install -g webpack-cli@<webpack_version_used_by_sdk>
-
Ensure that your global typescript version is the same as the one in the project. Otherwise, the build might fail 😞
npm install -g typescript@<typescript_version_used_by_sdk>
-
Clone repository
git clone git@github.com:corona-school/browser-sdk.git
-
Add official repository as second remote
git remote add dd https://github.com/DataDog/browser-sdk.git
-
Update main branch of our forked repository
git pull dd main git push origin main
-
Find latest tag, like
5.22in git history -
Checkout commit of version change, like this one
It's not the tag itself, but the merge commit that changes the version in
package.json -
Create new branch, based on commit above with the following name:
git checkout -b <used_version>-lern-fair-changes
Like
v5.22-lern-fair-changesfor versionv5.22 -
Apply our required changes like in this PR
- We have to remove some elements from
.gitignore, so that we are able to build and commit all files - The rum package need to refer to our new rum package. It's important that we'll use the name of the branch from the next step, not the current one!
- We have to remove some elements from
-
Push the changes and create a
draft PRfor our<used_version>-lern-fair-changesbranchCopy the PR description from the old PR of the last version to ensure that all information is available.
-
Create second branch based on first one, like
v5.22-lern-fair-packagesThe idea is that this branch will include all compiled packages that can be used later. This helps to distinguish between the changes we made and the compiled packages.
git checkout -b <used_version>-lern-fair-packages -
Push branch without any change
- It’s required to have the branch available before building as it's referenced in the rum package.json already.
-
Build all packages
This will generate all esm/cjs/d.ts files, which are required to use the module as npm dependency later on: You can find an example PR here
yarn install npm run build npm run build:bundle
It's very important that these steps are successful. If one of them fail in the middle, we can't use the module in our user-app.
-
Commit & Push changes to
<used_version>-lern-fair-packagesbranch -
Create a PR for the
<used_version>-lern-fair-packagesbranchCopy the PR description from the old PR of the last version to ensure that all information is available.
-
Change dependency in the user app package.json
-
Install new dependency
yarn install
-
Create PR and test changes
-
Open review environment of your PR
-
Create
RUNTIME_DD_ENV=reviewenvironment variable in Heroku -
Copy the following environment variables from
lernfair-user-app-devto your review environment- DD_ENV, DATADOG_SITE, DATADOG_API_KEY, RUNTIME_DD_APP_ID, RUNTIME_DD_CLIENT_TOKEN
-
Open application link and check:
- Ensure that your ad-blocker is disabled for your review application
- Check if the application sets any cookie
- You should have a
_dd_ssession storage entry - Login with test user and click around a little bit to generate a session
- Check Datadog to see if your session is there
- Watch session replay to see if all information are replaced with xxxx