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

Custom GA4 measurement protocol url #1162

Merged
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
7 changes: 4 additions & 3 deletions libs/core-functions/src/functions/ga4-destination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,10 @@ const Ga4Destination: JitsuFunction<AnalyticsServerEvent, Ga4Credentials> = asyn
ctx.log.info(`Ga4: no GA4 event is mapped for event type: ${event.type} ID: ${event.messageId}`);
return;
}
const debug = "";
//const debug = ctx.props.validationMode ? "/debug" : "";
const url = `https://www.google-analytics.com${debug}/mp/collect?${query}`;

const baseUrl = ctx.props.url ?? 'https://www.google-analytics.com/mp/collect';

const url = `${baseUrl}?${query}`;

gaRequest = {
...idPart,
Expand Down
2 changes: 1 addition & 1 deletion libs/core-functions/src/meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,8 @@ export const Ga4Credentials = z.object({
"The measurement ID associated with a stream.<br/><b>For Web:</b> found in the Google Analytics UI under: " +
"<b>Admin > Data Streams > choose your stream > Measurement ID</b><br/><b>For Apps</b>: the Firebase App ID, found in the Firebase console under: <b>Project Settings > General > Your Apps > App ID</b>"
),
url: z.string().url().describe("Measurement Protocol URL.<br/>Default: <code>https://www.google-analytics.com/mp/collect</code><br/>Default debug url: <code>https://www.google-analytics.com/debug/mp/collect</code>").default('https://www.google-analytics.com/mp/collect'),
events: z.string().optional().default("").describe(eventsParamDescription),
//validationMode: z.boolean().default(false).optional(),
});
export type Ga4Credentials = z.infer<typeof Ga4Credentials>;

Expand Down
2 changes: 1 addition & 1 deletion webapps/console/lib/schema/destinations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ export const coreDestinations: DestinationType<any>[] = [
{
id: "ga4",
icon: ga4Icon,
title: "Google Analytics 4",
title: "GA4 (Measurement Protocol)",
tags: "Product Analytics",
connectionOptions: CloudDestinationsConnectionOptions,
credentials: meta.Ga4Credentials,
Expand Down