feat: Add GA integration, support for GA4 (#4626)
* GA integration settings * trackingId -> measurementId Hook up script * Public page GA tracking Correct layout of settings * Remove multiple codepaths for loading GA measurementID, add missing db index * Remove unneccessary changes, tsc * test
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
import { PublicEnv } from "@shared/types";
|
||||
import { IntegrationType, PublicEnv } from "@shared/types";
|
||||
import { Environment } from "@server/env";
|
||||
import { Integration } from "@server/models";
|
||||
|
||||
// Note: This entire object is stringified in the HTML exposed to the client
|
||||
// do not add anything here that should be a secret or password
|
||||
export default function present(env: Environment): PublicEnv {
|
||||
export default function present(
|
||||
env: Environment,
|
||||
analytics?: Integration<IntegrationType.Analytics> | null
|
||||
): PublicEnv {
|
||||
return {
|
||||
URL: env.URL.replace(/\/$/, ""),
|
||||
AWS_S3_UPLOAD_BUCKET_URL: process.env.AWS_S3_UPLOAD_BUCKET_URL || "",
|
||||
@@ -26,5 +30,9 @@ export default function present(env: Environment): PublicEnv {
|
||||
GOOGLE_ANALYTICS_ID: env.GOOGLE_ANALYTICS_ID,
|
||||
RELEASE:
|
||||
process.env.SOURCE_COMMIT || process.env.SOURCE_VERSION || undefined,
|
||||
analytics: {
|
||||
service: analytics?.service,
|
||||
settings: analytics?.settings,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user