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

Sync proto with g3 to include url_from_markup AnalyticsContext field #3571

Merged
merged 9 commits into from
Sep 20, 2024
1,708 changes: 1,131 additions & 577 deletions src/proto/api_messages-test.js

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions src/proto/api_messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ export enum AnalyticsEvent {
IMPRESSION_REWARDED_AD = 49,
IMPRESSION_BYOP_NEWSLETTER_OPT_IN = 50,
IMPRESSION_REWARDED_AD_ERROR = 51,
IMPRESSION_HOSTED_PAGE_SUBSCRIPTION_OFFERS = 52,
IMPRESSION_HOSTED_PAGE_CONTRIBUTION_OFFERS = 53,
IMPRESSION_HOSTED_PAGE_SUBSCRIPTION_OFFERS_ERROR = 54,
IMPRESSION_HOSTED_PAGE_CONTRIBUTION_OFFERS_ERROR = 55,
ACTION_SUBSCRIBE = 1000,
ACTION_PAYMENT_COMPLETE = 1001,
ACTION_ACCOUNT_CREATED = 1002,
Expand Down Expand Up @@ -247,6 +251,8 @@ export enum AnalyticsEvent {
EVENT_BYOP_NEWSLETTER_OPT_IN_CODE_SNIPPET_ERROR = 3047,
EVENT_SUBSCRIPTION_PAYMENT_COMPLETE = 3050,
EVENT_CONTRIBUTION_PAYMENT_COMPLETE = 3051,
EVENT_HOSTED_PAGE_SUBSCRIPTION_PAYMENT_COMPLETE = 3054,
EVENT_HOSTED_PAGE_CONTRIBUTION_PAYMENT_COMPLETE = 3055,
EVENT_SUBSCRIPTION_STATE = 4000,
}

Expand Down Expand Up @@ -422,6 +428,7 @@ export class AnalyticsContext implements Message {
private loadEventStartDelay_: Duration | null;
private runtimeCreationTimestamp_: Timestamp | null;
private isLockedContent_: boolean | null;
private urlFromMarkup_: string | null;

constructor(data: unknown[] = [], includesLabel = true) {
const base = includesLabel ? 1 : 0;
Expand Down Expand Up @@ -483,6 +490,9 @@ export class AnalyticsContext implements Message {

this.isLockedContent_ =
data[17 + base] == null ? null : (data[17 + base] as boolean);

this.urlFromMarkup_ =
data[18 + base] == null ? null : (data[18 + base] as string);
}

getEmbedderOrigin(): string | null {
Expand Down Expand Up @@ -629,6 +639,14 @@ export class AnalyticsContext implements Message {
this.isLockedContent_ = value;
}

getUrlFromMarkup(): string | null {
return this.urlFromMarkup_;
}

setUrlFromMarkup(value: string): void {
this.urlFromMarkup_ = value;
}

toArray(includeLabel = true): unknown[] {
const arr: unknown[] = [
this.embedderOrigin_, // field 1 - embedder_origin
Expand All @@ -655,6 +673,7 @@ export class AnalyticsContext implements Message {
? this.runtimeCreationTimestamp_.toArray(includeLabel)
: [], // field 17 - runtime_creation_timestamp
this.isLockedContent_, // field 18 - is_locked_content
this.urlFromMarkup_, // field 19 - url_from_markup
];
if (includeLabel) {
arr.unshift(this.label());
Expand Down
1 change: 1 addition & 0 deletions src/utils/url-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ describe('serializeProtoMessageForUrl', () => {
['Timestamp', 22222, 0],
['Duration', 100, 0],
false,
null,
];
const analyticsEventMetaArray = ['AnalyticsEventMeta', 1, true, null];
const eventParamsArray = [
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading