I want to retrieve page views for my website using the google api. I need to use the core reporting API to do this:
https://developers.google.com/analytics/devguides/reporting/core/v3/
I want, on page load, to pull down data about page views for my website. At the moment I'm having problems seeing how to achieve this without first needing to manually authenticate the user (via a popup asking for a users google credentials). I don't want this - I simply want to retrieve some data for a given Google analytics profile.
I've generated a client id and an api id and am ready to go but can't find a clear example of how to query the api in the way I need.
Any ideas where in the documentation I can find what I need?
Related
I am working on a project that we need to retrieve all the unique visitors for each page in Google Analytics.
It is possible to see all the pages in one website and get the information for each page in the Google Analytics. However I could not find the Rest API for get all the pages or visitors for each page.
The final goal is that we need to have a drop box which shows all the pages/urls and after we select one of them it shows the number of the visitors.
You can use the Google Analytics API to extract the data on all the pages. You should start by checking out the Page Tracking dimensions.
Once you have the page you want you can filter additional requests to get additional data for each of the pages.
Tip: Look into the Google javascript client library.
I am working on a seemingly simple Facebook integration to allow my client (a local restaurant) to display their daily specials on their website. To make this work properly I need to sort through their posts, find the most recent post that has a certain string of characters (to distinguish from other posts they make), and display the post on the webpage. I know how to do this part but I am having trouble getting the data in the first place.
My question: How do I access the data for this Facebook page's posts? This needs to work
Without logging into Facebook
Preferably client-side
I would also like to use the JSON from the Graph API but I need an access token according to all the research I have done so far which would force me to go server-side. The Facebook social plugins are not specific enough to do what I want. Any help using the Graph API or another method to retrieve the page's posts is very much appreciated.
I am currently new for Google analytics API throu Javascript. I am implementing some of charts and for first load, page is redirecting me to google site to login with Analytics account and then returning to my orignal page, refresh & chart show.
Here, I would like to avoid users to redirect to google analytics page and instead of that I want to stored credentials somewhere in config file or in application variable.
I tried to search and read many blogs & articles however no success.
Is there any trick/ ideas by which I can get any API which could resolve this issue?
Google doesn't allow you to pull the physical charts onto your site, since they are generated on the fly. What you can do, is grab the data from their API and then display the data as needed on your site. I have searched and found a few examples with this one looking like it might do the trick.
It goes through the steps of pulling the data through the API, displaying/formatting/styling the data, and adding the chart to the page. Try that, Embed Analytics Using the Google Analytics API.
the reason why you are redirected to a Google login page, is that Google connects to the analytics data for whichever user you log in as. This means each user that logs into the site would see their own Analytics info, not the info from a static account.
If you want it to be the same user's analytics data no matter who is logging in, you would need to setup a "Service Account" on Google's API Console (https://code.google.com/apis/console/), then use those credentials when logging in.
It seems like a lot of people are looking for a solution to this, so I created a nuGet package that:
- connects to a "Service Account" you set up in the API Console
- Pulls any Google Analytics data you would like
- Displays that data using Google's Charts API
and it does all of this in a very easy to modify way. You can see more here: https://www.nuget.org/packages/GoogleAnalytics.GoogleCharts.NET/.
I wish to access Google Analytics data through their API using Javascript.
Basically I want to display on a website a list of the most visited pages for the past week/month. I can only use javascript for this.
I found this example on the official site http://code.google.com/p/google-api-javascript-client/wiki/Samples#Google_Analytics_API
Is there any way of accessing Google Analytics data without authentication? Do I need to somehow load a username/password in? To be clear, I want a website (that has Google Analytics tracking) to load analytics data from its own account.
I thought there might be a way to make certain data public, then query that somehow... Or perhaps create a limited user to access it. I can find no examples of either.
You can't access GA withouth authentication for rather the same reason you cannot access you bank account without authentication (because that would allow everybody else to access your account without authentication which might cause some inconvenience).
Google provides a complete example for GA access via Javascript: https://developers.google.com/analytics/solutions/articles/hello-analytics-api. However I don't think that's what you want (I think for that you need to be logged in to Google to actually retrieve data).
You could however use Google Apps Script to pull data into a Google Spreadsheet and embed that into your page (at least I think that should be safe).
Updated: Google has since released the Google Analytics superProxy which allows to share Analytics data with the public safely.
We need to show the number of visits for pages of our website. We already use GA for general reports and we assumed that it might make sense to use GA API to get number of visits data from GA instead of building our own counters and increase load to our database and web server.
I read documentation and already know how to build queries that I need. The main problem I'm trying to work around right now is an authorization process. Sounds like if we use OAuth 2.0 each user has to authenticate before he/she can see the statistics on the page and they will have access to statistics of their websites (if they have them registered with GA). In our case this is incorrect, everything we need is just to show our own GA stats at our own website. Easy task as we thought initially but it doesn't sound like that anymore.
Is there a way to authorize our website to Google (like we send come credentials when we use Maps API) and show stats automatically to any user? We wanted to implement it on client side via JS but if this is possible to implement it on server-side only - that's OK. The target platform for server-side implementation is ASP.NET (just in case). Can someone point us in the right direction?
Quite a few options:
You can use OOCharts and a script like this
Use a service like embedded analytics (paid)
Use SeeTheStats and it's widgets
Use google charts and JavaScript
Use explanium to embed a ga chart
Piwik can embed charts too.