Third Party Topics Fetch

810 views
Skip to first unread message

Pavas Goswami

unread,
Aug 22, 2023, 11:24:34 AM8/22/23
to Topics API announcements, Himanshu Agrawal
Hi,
Not able to fetch topics from third party sites.
please share some code to fetch topics from third party domains. 
I am using document.browsingTopics(), which only sets the Topics but i can only get the topics if i am visiting origin or subdomains, but not able to fetch topics from different domains.

For Eg. 
1. Visiting xyz.com.   topics set ---- News
2. now visiting abc.com topics set ----- Entertainment
so how can i get topics of abc.com into xyz.com server
Note: I am owning both domains: xyz.com and abc.com

please share the code which can implement this, either by header or js approach.

Sam Dutton

unread,
Aug 30, 2023, 10:50:48 AM8/30/23
to Topics API announcements, pavas....@htdigital.in, Himanshu Agrawal
Hi Pavas

This group is for Topics API announcements. The best place to ask questions about API usage is our privacy-sandbox-dev-support repo.

I've added an issue there for your question, with the same answer as below. If you have more questions, ask on the dev-support issue rather than on this thread.

Thanks!

Sam

...............

You need to observe topics with code from the same origin as the code you call to access topics.

To access topics from xyz.com that you've observed on abc.com, you'll need to call document.browsingTopics() from an iframe embedded on abc.com that has a src with origin xyz.com.

Alternatively, you could use headers to observe and access topics.

You might find the following two demos useful as a starting point:

Reply all
Reply to author
Forward
0 new messages