Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/types/src/deployment-configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export type ClientDeploymentConfiguration = {
*/
ALLOW_3P_MODULES?: boolean;
ENABLE_EMAIL_OPT_IN?: boolean;
ENABLE_BACKEND_TRACK_ACTION?: boolean;
FAKE_MODE?: boolean;
DEV_BACKEND_MODE?: boolean;
SHARE_SURFACE_URL_TEMPLATES: Record<string, string>;
Expand Down
1 change: 1 addition & 0 deletions packages/unified-server/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export async function createClientConfig(opts: {
SHELL_HOST_ORIGINS: flags.SHELL_HOST_ORIGINS,
SHELL_PREFIX: flags.SHELL_PREFIX,
ENABLE_EMAIL_OPT_IN: flags.ENABLE_EMAIL_OPT_IN,
ENABLE_BACKEND_TRACK_ACTION: flags.ENABLE_BACKEND_TRACK_ACTION,
SHARE_SURFACE_URL_TEMPLATES: flags.SHARE_SURFACE_URL_TEMPLATES,
ENABLE_NEW_URL_SCHEME: flags.ENABLE_NEW_URL_SCHEME,
ENABLE_SHARING_2: flags.ENABLE_SHARING_2,
Expand Down
4 changes: 4 additions & 0 deletions packages/unified-server/src/flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ export const SHELL_PREFIX = getString("SHELL_PREFIX");

export const ENABLE_EMAIL_OPT_IN = getBoolean("ENABLE_EMAIL_OPT_IN");

export const ENABLE_BACKEND_TRACK_ACTION = getBoolean(
"ENABLE_BACKEND_TRACK_ACTION"
);

export const ENABLE_OPAL_ADK = getBoolean("ENABLE_OPAL_ADK");

export const ENABLE_OUTPUT_TEMPLATES = getBoolean("ENABLE_OUTPUT_TEMPLATES");
Expand Down
22 changes: 22 additions & 0 deletions packages/visual-editor/src/ui/utils/oauth-based-opal-shell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -927,8 +927,30 @@ export class OAuthBasedOpalShell implements OpalShellHostProtocol {
);
trackAction = async (action: string, payload: Record<string, string>) => {
this.actionEventSender.sendEvent(action, payload);

// Also send to the appcatalyst backend for server-side analytics.
this.#trackActionViaAppCatalyst(action, payload);
};

#trackActionViaAppCatalyst(event: string, payload: Record<string, string>) {
if (!CLIENT_DEPLOYMENT_CONFIG.ENABLE_BACKEND_TRACK_ACTION) {
return;
}
this.fetchWithCreds(
new URL(
"/v1beta1/trackAction",
CLIENT_DEPLOYMENT_CONFIG.BACKEND_API_ENDPOINT
),
{
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ event, payload }),
}
).catch((error) => {
console.warn("[shell host] trackAction RPC failed", error);
});
}

trackProperties = async (payload: Record<string, string | undefined>) => {
this.actionEventSender.setProperties(payload);
};
Expand Down
Loading