chromium/content/browser/attribution_reporting/attribution_reporting.proto

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

syntax = "proto2";

option optimize_for = LITE_RUNTIME;

package content.proto;

message AttributionAggregationKey {
  optional uint64 high_bits = 1;
  optional uint64 low_bits = 2;
}

message AttributionAggregatableSource {
  map<string, AttributionAggregationKey> keys = 1;
}

message AttributionFilterValues {
  repeated string values = 1;
}

// Proto equivalent of `blink::mojom::AttributionData`.
message AttributionFilterData {
  map<string, AttributionFilterValues> filter_values = 1;
}

message TriggerData {
  repeated uint32 trigger_data = 1;
}

// Eventually will migrate other non indexed source fields into this proto.
message AttributionReadOnlySourceData {
  // Must be non-negative.
  optional int32 max_event_level_reports = 1;
  // Stored as microseconds offset from the source's registration time.
  optional int64 event_level_report_window_start_time = 2;
  // Stored as microseconds offset from the source's registration time.
  repeated int64 event_level_report_window_end_times = 3;
  // Value can only be between 0 and 1.
  optional double randomized_response_rate = 4;

  enum TriggerDataMatching {
    MODULUS = 0;
    EXACT = 1;
  };

  optional TriggerDataMatching trigger_data_matching = 5;

  optional bool debug_cookie_set = 6;

  optional double event_level_epsilon = 7;

  // If absent, will be deserialized using the defaults for the source type.
  optional TriggerData trigger_data = 8;

  optional AttributionAggregationKey aggregatable_debug_key_piece = 9;
}

message AttributionEventLevelMetadata {
  optional uint32 trigger_data = 1;
  optional int64 priority = 2;
}

message AttributionCommonAggregatableMetadata {
  enum SourceRegistrationTimeConfig {
    INCLUDE = 0;
    EXCLUDE = 1;
  }

  optional SourceRegistrationTimeConfig source_registration_time_config = 3;
  optional string coordinator_origin = 4;
  optional string trigger_context_id = 5;
  optional uint32 filtering_id_max_bytes = 6;

  reserved 1, 2;
  reserved "coordinator";
}

message AttributionAggregatableMetadata {
  optional AttributionCommonAggregatableMetadata common_data = 1;

  message Contribution {
    optional AttributionAggregationKey key = 1;
    optional uint32 value = 2;
    optional uint64 filtering_id = 3;
  }
  repeated Contribution contributions = 2;
}

message AttributionNullAggregatableMetadata {
  optional AttributionCommonAggregatableMetadata common_data = 1;
  // Stored as microseconds since the Windows epoch (1601-01-01 00:00:00 UTC).
  optional int64 fake_source_time = 2;
}

message AttributionScopesData {
  repeated string scopes = 1;
  // Must be positive.
  optional uint32 scope_limit = 2;
  // Must be positive.
  optional uint32 max_event_states = 3;
}