chromium/content/test/data/attribution_reporting/interop/rate_limit_max_attributions.json

{
  "description": "Max attributions per rate-limit window",
  "api_config": {
    "rate_limit_max_attributions": "2"
  },
  "input": {
    "registrations": [
      {
        "timestamp": "0",
        "registration_request": {
          "context_origin": "https://example.source.test",
          "Attribution-Reporting-Eligible": "navigation-source"
        },
        "responses": [
          {
            "url": "https://reporter.test/register-source",
            "debug_permission": true,
            "response": {
              "Attribution-Reporting-Register-Source": {
                "destination": "https://example.destination.test",
                "source_event_id": "111",
                "expiry": "86400",
                "aggregation_keys": {
                  "a": "0x1"
                }
              }
            }
          }
        ]
      },
      // Should result in an event-level report. This is counted as one event-level
      // attribution.
      {
        "timestamp": "1000",
        "registration_request": {
          "context_origin": "https://destination.test"
        },
        "responses": [
          {
            "url": "https://reporter.test/register-trigger",
            "response": {
              "Attribution-Reporting-Register-Trigger": {
                "event_trigger_data": [
                  {
                    "trigger_data": "1"
                  }
                ]
              }
            }
          }
        ]
      },
      // Should result in an aggregatable report. This is counted as one aggregatable
      // attribution.
      {
        "timestamp": "1500",
        "registration_request": {
          "context_origin": "https://destination.test"
        },
        "responses": [
          {
            "url": "https://reporter.test/register-trigger",
            "response": {
              "Attribution-Reporting-Register-Trigger": {
                "aggregatable_trigger_data": [
                  {
                    "source_keys": ["a"],
                    "key_piece": "0x10"
                  }
                ],
                "aggregatable_values": {
                  "a": 123
                }
              }
            }
          }
        ]
      },
      // Should be preferred over the first source as it's more recent.
      {
        "timestamp": "2000",
        "registration_request": {
          "context_origin": "https://source.test",
          "Attribution-Reporting-Eligible": "navigation-source"
        },
        "responses": [
          {
            "url": "https://reporter.test/register-source",
            "debug_permission": true,
            "response": {
              "Attribution-Reporting-Register-Source": {
                "destination": [
                  "https://destination.test",
                  "https://another-destination.test"
                ],
                "source_event_id": "222",
                "expiry": "86400",
                "aggregation_keys": {
                  "b": "0x2"
                }
              }
            }
          }
        ]
      },
      // Should not result in any report as neither event-level trigger data
      // nor aggregatable trigger data is specified. This is counted as 0
      // attributions.
      {
        "timestamp": "3000",
        "registration_request": {
          "context_origin": "https://destination.test"
        },
        "responses": [
          {
            "url": "https://reporter.test/register-trigger",
            "response": {
              "Attribution-Reporting-Register-Trigger": {}
            }
          }
        ]
      },
      // Should result in an event-level report and an aggregatable report
      // because the attribution limit is not reached. This is counted as one
      // event-level attribution and an aggregatable attribution.
      {
        "timestamp": "3001",
        "registration_request": {
          "context_origin": "https://destination.test"
        },
        "responses": [
          {
            "url": "https://reporter.test/register-trigger",
            "response": {
              "Attribution-Reporting-Register-Trigger": {
                "event_trigger_data": [
                  {
                    "trigger_data": "7"
                  }
                ],
                "aggregatable_trigger_data": [
                  {
                    "source_keys": ["b"],
                    "key_piece": "0x20"
                  }
                ],
                "aggregatable_values": {
                  "b": 321
                }
              }
            }
          }
        ]
      },
      // Should not result in an event-level report due to the rate limit.
      {
        "timestamp": "3003",
        "registration_request": {
          "context_origin": "https://destination.test"
        },
        "responses": [
          {
            "url": "https://reporter.test/register-trigger",
            "debug_permission": true,
            "response": {
              "Attribution-Reporting-Register-Trigger": {
                "event_trigger_data": [
                  {
                    "trigger_data": "0"
                  }
                ],
                "debug_reporting": true
              }
            }
          }
        ]
      },
      // Should not result in an aggregatable report due to the rate limit.
      {
        "timestamp": "3004",
        "registration_request": {
          "context_origin": "https://destination.test"
        },
        "responses": [
          {
            "url": "https://reporter.test/register-trigger",
            "debug_permission": true,
            "response": {
              "Attribution-Reporting-Register-Trigger": {
                "aggregatable_trigger_data": [
                  {
                    "source_keys": ["b"],
                    "key_piece": "0x30"
                  }
                ],
                "aggregatable_values": {
                  "b": 456
                },
                "debug_reporting": true
              }
            }
          }
        ]
      },
      // Should result in an event-level report because the attribution limit
      // is separate for a different destination site.
      {
        "timestamp": "3100",
        "registration_request": {
          "context_origin": "https://another-destination.test"
        },
        "responses": [
          {
            "url": "https://reporter.test/register-trigger",
            "response": {
              "Attribution-Reporting-Register-Trigger": {
                "event_trigger_data": [
                  {
                    "trigger_data": "3"
                  }
                ]
              }
            }
          }
        ]
      },
      // Should be preferred over the second source as it's more recent.
      {
        "timestamp": "4000",
        "registration_request": {
          "context_origin": "https://another-source.test",
          "Attribution-Reporting-Eligible": "navigation-source"
        },
        "responses": [
          {
            "url": "https://reporter.test/register-source",
            "response": {
              "Attribution-Reporting-Register-Source": {
                "destination": "https://destination.test",
                "source_event_id": "333"
              }
            }
          }
        ]
      },
      // Should result in an event-level report because the attribution limit
      // is separate for a different source site.
      {
        "timestamp": "5000",
        "registration_request": {
          "context_origin": "https://destination.test"
        },
        "responses": [
          {
            "url": "https://reporter.test/register-trigger",
            "response": {
              "Attribution-Reporting-Register-Trigger": {
                "event_trigger_data": [
                  {
                    "trigger_data": "2"
                  }
                ]
              }
            }
          }
        ]
      },
      {
        "timestamp": "8000",
        "registration_request": {
          "context_origin": "https://source.test",
          "Attribution-Reporting-Eligible": "navigation-source"
        },
        "responses": [
          {
            "url": "https://example.reporter.test/register-source",
            "response": {
              "Attribution-Reporting-Register-Source": {
                "destination": "https://destination.test",
                "source_event_id": "555"
              }
            }
          }
        ]
      },
      {
        "timestamp": "8001",
        "registration_request": {
          "context_origin": "https://source.test",
          "Attribution-Reporting-Eligible": "navigation-source"
        },
        "responses": [
          {
            "url": "https://reporter2.test/register-source",
            "response": {
              "Attribution-Reporting-Register-Source": {
                "destination": "https://destination.test",
                "source_event_id": "555"
              }
            }
          }
        ]
      },
      // Should not result in an event-level report because the attribution limit
      // applies to reporting sites, not reporting origins.
      {
        "timestamp": "8500",
        "registration_request": {
          "context_origin": "https://destination.test"
        },
        "responses": [
          {
            "url": "https://example.reporter.test/register-trigger",
            "response": {
              "Attribution-Reporting-Register-Trigger": {
                "event_trigger_data": [
                  {
                    "trigger_data": "4"
                  }
                ]
              }
            }
          }
        ]
      },
      // Should result in an event-level report because the attribution limit
      // is separate for a different reporting site.
      {
        "timestamp": "9000",
        "registration_request": {
          "context_origin": "https://destination.test"
        },
        "responses": [
          {
            "url": "https://reporter2.test/register-trigger",
            "response": {
              "Attribution-Reporting-Register-Trigger": {
                "event_trigger_data": [
                  {
                    "trigger_data": "4"
                  }
                ]
              }
            }
          }
        ]
      },
      // Should be preferred over the third source as it's more recent.
      {
        "timestamp": "10000",
        "registration_request": {
          "context_origin": "https://source.test",
          "Attribution-Reporting-Eligible": "event-source"
        },
        "responses": [
          {
            "url": "https://reporter.test/register-source",
            "debug_permission": true,
            "response": {
              "Attribution-Reporting-Register-Source": {
                "destination": "https://destination.test",
                "source_event_id": "666"
              }
            }
          }
        ]
      },
      // Should be dropped due to attribution limit that ignores source type.
      {
        "timestamp": "11000",
        "registration_request": {
          "context_origin": "https://destination.test"
        },
        "responses": [
          {
            "url": "https://reporter.test/register-trigger",
            "debug_permission": true,
            "response": {
              "Attribution-Reporting-Register-Trigger": {
                "debug_reporting": true,
                "event_trigger_data": [
                  {
                    "trigger_data": "5"
                  }
                ]
              }
            }
          }
        ]
      },
      // Should result in an event-level report because the first report falls
      // outside the rate limit window.
      {
        "timestamp": "2592000000",
        "registration_request": {
          "context_origin": "https://destination.test"
        },
        "responses": [
          {
            "url": "https://reporter.test/register-trigger",
            "response": {
              "Attribution-Reporting-Register-Trigger": {
                "event_trigger_data": [
                  {
                    "trigger_data": "6"
                  }
                ]
              }
            }
          }
        ]
      }
    ]
  },
  "output": {
    "reports": [
      {
        "payload": [
          {
            "body": {
              "attribution_destination": "https://destination.test",
              "limit": "2",
              "source_event_id": "222",
              "source_site": "https://source.test"
            },
            "type": "trigger-event-attributions-per-source-destination-limit"
          }
        ],
        "report_time": "3003",
        "report_url": "https://reporter.test/.well-known/attribution-reporting/debug/verbose"
      },
      {
        "payload": [
          {
            "body": {
              "attribution_destination": "https://destination.test",
              "limit": "2",
              "source_event_id": "222",
              "source_site": "https://source.test"
            },
            "type": "trigger-aggregate-attributions-per-source-destination-limit"
          }
        ],
        "report_time": "3004",
        "report_url": "https://reporter.test/.well-known/attribution-reporting/debug/verbose"
      },
      {
        "payload": [
          {
            "body": {
              "attribution_destination": "https://destination.test",
              "limit": "2",
              "source_event_id": "666",
              "source_site": "https://source.test"
            },
            "type": "trigger-event-attributions-per-source-destination-limit"
          }
        ],
        "report_time": "11000",
        "report_url": "https://reporter.test/.well-known/attribution-reporting/debug/verbose"
      },
      {
        "payload": {
          "aggregation_coordinator_origin": "https://coordinator.test",
          "histograms": [
            {
              "id": "0",
              "key": "0x11",
              "value": 123
            }
          ],
          "shared_info": {
            "api": "attribution-reporting",
            "attribution_destination": "https://destination.test",
            "reporting_origin": "https://reporter.test",
            "scheduled_report_time": "3601",
            "version": "1.0"
          }
        },
        "report_time": "3601500",
        "report_url": "https://reporter.test/.well-known/attribution-reporting/report-aggregate-attribution"
      },
      {
        "payload": {
          "aggregation_coordinator_origin": "https://coordinator.test",
          "histograms": [
            {
              "id": "0",
              "key": "0x22",
              "value": 321
            }
          ],
          "shared_info": {
            "api": "attribution-reporting",
            "attribution_destination": "https://destination.test",
            "reporting_origin": "https://reporter.test",
            "scheduled_report_time": "3603",
            "version": "1.0"
          }
        },
        "report_time": "3603001",
        "report_url": "https://reporter.test/.well-known/attribution-reporting/report-aggregate-attribution"
      },
      {
        "payload": {
          "attribution_destination": "https://destination.test",
          "randomized_trigger_rate": 0.0001372,
          "scheduled_report_time": "86400",
          "source_event_id": "111",
          "source_type": "navigation",
          "trigger_data": "1"
        },
        "report_url": "https://reporter.test/.well-known/attribution-reporting/report-event-attribution",
        "report_time": "86400000"
      },
      {
        "payload": {
          "attribution_destination": [
            "https://another-destination.test",
            "https://destination.test"
          ],
          "randomized_trigger_rate": 0.0001372,
          "scheduled_report_time": "86402",
          "source_event_id": "222",
          "source_type": "navigation",
          "trigger_data": "7"
        },
        "report_time": "86402000",
        "report_url": "https://reporter.test/.well-known/attribution-reporting/report-event-attribution"
      },
      {
        "payload": {
          "attribution_destination": [
            "https://another-destination.test",
            "https://destination.test"
          ],
          "randomized_trigger_rate": 0.0001372,
          "scheduled_report_time": "86402",
          "source_event_id": "222",
          "source_type": "navigation",
          "trigger_data": "3"
        },
        "report_url": "https://reporter.test/.well-known/attribution-reporting/report-event-attribution",
        "report_time": "86402000"
      },
      {
        "payload": {
          "attribution_destination": "https://destination.test",
          "randomized_trigger_rate": 0.0024263,
          "scheduled_report_time": "172804",
          "source_event_id": "333",
          "source_type": "navigation",
          "trigger_data": "2"
        },
        "report_url": "https://reporter.test/.well-known/attribution-reporting/report-event-attribution",
        "report_time": "172804000"
      },
      {
        "payload": {
          "attribution_destination": "https://destination.test",
          "randomized_trigger_rate": 0.0024263,
          "scheduled_report_time": "172808",
          "source_event_id": "555",
          "source_type": "navigation",
          "trigger_data": "4"
        },
        "report_url": "https://reporter2.test/.well-known/attribution-reporting/report-event-attribution",
        "report_time": "172808001"
      },
      {
        "payload": {
          "attribution_destination": "https://destination.test",
          "randomized_trigger_rate": 0.0000025,
          "scheduled_report_time": "2592010",
          "source_event_id": "666",
          "source_type": "event",
          "trigger_data": "0"
        },
        "report_url": "https://reporter.test/.well-known/attribution-reporting/report-event-attribution",
        "report_time": "2592010000"
      }
    ]
  }
}