I need to display the analytics of my site to all the users, but Using OAuth it displays the analytics of the sites configured for the logged in user. How can I implement a dashboard using embed API but showing my website analytics only?
The best possibility I can come up at is using API Key instead of Client ID, but I am unable to find a way to do it.
Does anyone have anything else in mind.
API keys are used for accessing public data, like the list of dimensions and metrics in the metadata API. In order to access private Google Analytics data you must use Oauth2.
So you don't want to use the API key, what you want to do is use a service account and then authorize the service account service-side, receive and access token from that authorization flow, and then pass that access token to the Embed API.
Here's a full working example: https://ga-dev-tools.appspot.com/embed-api/server-side-authorization/