Skip to content

Commit

Permalink
Merge pull request #124 from pwa-builder/4541-cloup-apk-referrer-anal…
Browse files Browse the repository at this point in the history
…ytics

#4541: Add referrer field to Cloud APK analytics
  • Loading branch information
zateutsch authored Dec 13, 2023
2 parents bf146a1 + 8b70948 commit 8860909
Show file tree
Hide file tree
Showing 20 changed files with 29 additions and 493 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ pids
*.pid.lock

#remove js files
build/*.js
**/*.js
**/*.js.map
!static/*.js

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
Expand Down
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,23 @@ This tool generates a zip file containing both an `.apk` file (for testing) and

Please use our [main repository for any issues/bugs/features suggestion](https://github.com/pwa-builder/PWABuilder/issues/new/choose).

# Running locally
# Running Locally

Run `npm start dev`, then launch your browser to localhost:3333. A page will launch that allows you to generate an Android package.
You will need [Docker](https://www.docker.com/products/docker-desktop/) and the [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) to run this service locally.

You may also generate a package manually by sending a POST to `/generateAppPackage` with the following JSON body:
Steps:

1. Run `az acr login -n pwabuilder` to authenticate with our Azure Container Registry.

2. If you are testing locally, go to `Dockerfile` and change line 13 to `NODE_ENV=test`.

3. Run `npm run docker:build` to build the Docker image, this may take a while the first time you run it.

4. Once the build is complete, run `npm run docker:run` to start the Docker container.

5. Visit `localhost` to see the CloudAPK testing interface.

If you don't want to use the testing interface, you may also generate a package manually by sending a POST to `/generateAppPackage` with the following JSON body:

```json
{
Expand Down
13 changes: 0 additions & 13 deletions app.js

This file was deleted.

1 change: 0 additions & 1 deletion app.js.map

This file was deleted.

1 change: 0 additions & 1 deletion build/analytics.js.map

This file was deleted.

4 changes: 3 additions & 1 deletion build/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,13 @@ export function trackEvent(
console.error("App insights no defaultClient");
return;
}

var properties: any = {
name: analyticsInfo.name,
url: analyticsInfo.url,
platformId: analyticsInfo.platformId,
platformIdVersion: analyticsInfo.platformIdVersion,
referrer: analyticsInfo.referrer,
};

try {
Expand Down Expand Up @@ -87,4 +88,5 @@ export type AnalyticsInfo = {
platformId: string | null;
platformIdVersion: string | null;
correlationId: string | null;
referrer: string | null;
};
1 change: 0 additions & 1 deletion build/androidPackageOptions.js.map

This file was deleted.

1 change: 0 additions & 1 deletion build/appPackageRequest.js.map

This file was deleted.

1 change: 0 additions & 1 deletion build/bubbleWrapper.js.map

This file was deleted.

1 change: 0 additions & 1 deletion build/generatedAppPackage.js.map

This file was deleted.

1 change: 0 additions & 1 deletion build/signingOptions.js.map

This file was deleted.

1 change: 0 additions & 1 deletion build/urlLogger.js.map

This file was deleted.

1 change: 0 additions & 1 deletion build/utils.js.map

This file was deleted.

6 changes: 3 additions & 3 deletions env/test.env
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Environment
NODE_ENV=testing
NODE_ENV=test

# Server
PORT=4000
HOST=localost
PORT=80
HOST=localhost

JDK8PATH=/usr/lib/jvm/java-8-openjdk-amd64/
ANDROIDTOOLSPATH=/opt/android-sdk
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
"main": "server.js",
"type": "module",
"scripts": {
"start": "NODE_ENV=production&& node ./server.js",
"start": "node ./server.js",
"postinstall": "tsc",
"dev": "node --inspect=5858 --loader ts-node/esm ./server.ts",
"build": "tsc"
"build": "tsc",
"docker:build": "docker build -t cloud-apk .",
"docker:run": "docker run -p 80:80 cloud-apk"
},
"repository": {
"type": "git",
Expand Down
Loading

0 comments on commit 8860909

Please sign in to comment.