diff --git a/api.bs b/api.bs index 8f29ff2..9961184 100644 --- a/api.bs +++ b/api.bs @@ -1598,7 +1598,7 @@ after the [=common matching logic=] is applied and privacy budgeting occurs. To do attribution and fill a histogram, given [=validated conversion options=] |options|, [=site=] |topLevelSite|, - [=site=] |intermediarySite|, + [=site=] or `undefined` |intermediarySite|, and [=moment=] |now|: 1. Let |matchedImpressions| be an [=set/is empty|empty=] [=set=]. @@ -1688,7 +1688,7 @@ To create an all-zero histogram, given an integer |size|: To perform common matching logic, given [=validated conversion options=] |options|, [=site=] |topLevelSite|, -[=site=] |intermediarySite|, +[=site=] or `undefined` |intermediarySite|, [=epoch index=] |epoch|, and [=moment=] |now|: 1. Let |matching| be an [=set/is empty|empty=] [=set=]. @@ -1716,11 +1716,11 @@ To perform common matching logic, given and [=set/contains|does not contain=] |topLevelSite|, [=iteration/continue=]. - 1. If |intermediarySite| is not `undefined`, let |caller| be |intermediarySite|. - Otherwise, let |caller| be |topLevelSite|. + 1. Let |conversionCaller| be |intermediarySite| if it is not `undefined`, + |topLevelSite| otherwise. 1. If |impression|'s [=impression/conversion callers=] [=set/is empty|is not empty=] - and [=set/contains|does not contain=] |caller|, + and [=set/contains|does not contain=] |conversionCaller|, [=iteration/continue=]. 1. If |options|' [=validated conversion options/match values=] [=set/is empty|is not empty=] @@ -1732,9 +1732,11 @@ To perform common matching logic, given [=list/contains|does not contain=] |impression|'s [=impression/impression site=], [=iteration/continue=]. + 1. Let |impressionCaller| be |impression|'s [=impression/intermediary site=] + if it is not `undefined`, |impression|'s [=impression/impression site=] otherwise. + 1. If |options|' [=validated conversion options/impression callers=] [=set/is empty|is not empty=] - and [=set/contains|does not contain=] |impression|'s [=impression/intermediary site=] - or |impression|'s [=impression/impression site=], + and [=set/contains|does not contain=] |impressionCaller|, [=iteration/continue=]. 1. [=set/Append=] |impression| to |matching|. diff --git a/impl/src/backend.ts b/impl/src/backend.ts index 1b33ae4..5416308 100644 --- a/impl/src/backend.ts +++ b/impl/src/backend.ts @@ -392,10 +392,10 @@ export class Backend { ) { continue; } - let caller = intermediarySite ?? topLevelSite; + const conversionCaller = intermediarySite ?? topLevelSite; if ( impression.conversionCallers.size > 0 && - !impression.conversionCallers.has(caller) + !impression.conversionCallers.has(conversionCaller) ) { continue; } @@ -408,10 +408,12 @@ export class Backend { ) { continue; } - // TODO: The wording from Step 4.10 of - // https://w3c.github.io/ppa/#common-matching-logic is a bit ambiguous. - caller = impression.intermediarySite ?? impression.impressionSite; - if (impressionCallers.size > 0 && !impressionCallers.has(caller)) { + const impressionCaller = + impression.intermediarySite ?? impression.impressionSite; + if ( + impressionCallers.size > 0 && + !impressionCallers.has(impressionCaller) + ) { continue; } matching.add(impression);