klmdb
klmdb

Reputation: 815

Allowing user access to analytics

I would like to enable (some) of my users to view my website's analytics data.

Our website has a bunch of groups where users can add content. I would like to enable certain users (group admins), to view usage statistics for that specific group. Ofcourse the data should only be accessable to those users with the VIEW_ANALYTICS right, not to any others.

Is there any way to do this in Google Analytics, or is there some other platform I could use to easily achieve this goal (we use AWS for our hosting)?

Regards, klmdb

Upvotes: 1

Views: 89

Answers (1)

Rothrock
Rothrock

Reputation: 1511

The Google Embed API allows you to display analytics data in your own pages. Pages that are only accessible to the members of your VIEW_ANALYTICS group.

You can create a service account and give it the appropriate access in the analytics user management for the property.

You also authorize the service account to use the embed API in the developers API console. (I don't have enough points to include more than two links in an answer.) In the API console you can generate a private key (p12 or json format) which you then use on your server to authenticate the request for analytics data.

You don't say which technologies you are using, but they show Java and Python examples of how to set up the authentication by the Service Account. I've also seen some node.js and php libraries.

This way you don't have to manage who has access through the google anayltics admin system, you just need to control who has access to your "dashboard" page.

I have done this all with client-side javascript and it works. Of course the client-side nature means that anybody who knows how to use browser debug tools can get our private-key, but in our particular case I'm not worried about it. On the other had it seem like you need to keep some security around this so I wouldn't recommend the client-side solution.

Upvotes: 1

Related Questions