demo · v134

interestGroups() in window vs fenced frame context

interestGroups() in a shared storage worklet returns different data depending on where the worklet is running. In a normal page window context, it returns all IGs owned by the origin. Inside a fenced frame (loaded as the winning ad), the same call returns only the IG that won the current auction — the one that caused this fenced frame to be loaded.

Simulated demo Fenced frames and Protected Audience auctions require enrollment and flag overrides. This demo uses mock data that reflects the actual shape of the API in each context — the structural difference is real, only the data is synthetic.
Normal window context — all origin IGs
A sharedStorage.run() call from a publisher page. The worklet runs with the publisher origin as owner. interestGroups() returns the full list of IGs that the DSP registered for this origin.
Returned: interest groups
    Fenced frame context — winning IG only
    The same worklet call from inside a fenced frame loaded for the winning ad. interestGroups() returns only the one IG whose bid won the auction. The broader audience list is not exposed — it stays opaque.
    Returned: interest group (the winner)

      Key differences

      Groups returned All IGs for origin owner  vs  Only the auction-winning IG
      StorageInterestGroup metadata Full timing fields  vs  Winning IG timing fields only
      Use case Reach / frequency aggregation  vs  Post-auction measurement
      Private Aggregation context Publisher-scoped histogram  vs  Fenced frame report sink
      // Normal window context — from a publisher page:
      // const igs = await sharedStorage.interestGroups();
      // // returns: [
      // //   { owner: "https://dsp.example", name: "campaign-shoes", ... },
      // //   { owner: "https://dsp.example", name: "campaign-electronics", ... },
      // //   ...all IGs for the owner origin
      // // ]
      //
      // Fenced frame context — from inside the winning ad frame:
      // const igs = await sharedStorage.interestGroups();
      // // returns: [
      // //   { owner: "https://dsp.example", name: "campaign-shoes", ... }
      // //   // ONLY the IG that won the auction for this frame
      // // ]
      //
      // The caller origin is the same; the execution context determines scope.

      see also