Google Analytics PHP API : get reporting - php

I have a professional website using Google Analytics for metrics and I try to automatize one task I used to do manually but.. not able to understand if it's possible ?!
I just began to using the Google PHP client library to access the Google Analytics API on my website Test with the HelloAnalytics.php file is OK, I manage to connect and retrieve my data.
What i'm trying to do is :
Get all URLs viewed in the past 24H (what you can see when you navigate in the GA dashboard -> Behavior -> Site content -> All pages)
Combine those datas with my custom Definition which is in fact a special token i generate for every users on my website via PHP, then send it thought with Javascript and ga('set', 'mycustomdefinition', 'my token');
Is it possible ?
Many thanks in advance for your support !

Data under 24-48 hours old has probably not completed processing so I recommend not looking at data viewed in the last 24 hours it wont be correct. Other wise yes you can see this.
Assuming you mean custom Dimension yes you can extract custom dimensions and the page path in the same request.
You might want to have a look at the Dimensions & metrics explorer as well as the google analytics query explorer both will help you understand what data can be extracted from the API.

Related

Automatic php script to know how many view have your page with Google Analytics

I want to know the number of view of my web page using a script php that query Google Analytic.
I know that there is the Google API, but there is a bad documentation of it.
You know how do that?
are you looking for a simple script that just saves the number of a page view in the database and later you could get the value , or you want to get the number of page view calculated with the google Analytic api ? in that case , you're talking about building a Rest Api (Interact with the google server) and you should read about the google APi .

Twitter API or Library to remember the session

I've been going through the Twitter API, but they are not as friendly as Facebook. My requirement is remember the authentication in the server / db and post user messages to the timeline without invoking twitter UI. Ofcourse I know we need to allow first time authentication via Twitter UI.
I'm not sure where to start and 2 days of Google search didn't end at any place where I can get started. Is there any document, resources, library (PHP or JavaScript) available to execute such scenario?
Thanks in advance.
This is a wonderful tutorial on how to auto post via PHP to Twitter. Check it out

Google Calendar API - Not showing calendar

I've downloaded the Google API Client and installed it on my Server. I set up my API and my client ID.
I configured the PHP file and now I'm trying to open it:
http://euotm.net/google-api-php-client/examples/calendar/simple.php
I signin using a Google Account, but then all I get is a code.
WHy does that happen? I need it to show a calendar.
I'm new to this API, so I really don't know much.
Thanks ahead,
Tom.
Indeed google calendar api doesn't provide a display widget to integrate calendar to your application. The api only gives you the possibility to retrieve every details about your calendars and their events, and then you'll have to find a way to display it on your screen if you want a nice layout.
have you
require_once 'google-api-php-client/src/Google_Client.php';
require_once 'google-api-php-client/src/contrib/Google_CalendarService.php';
these files in your code ? i think you may miss it. what error, you are getting kindly make more sense about this
I am having the same issue. From what I've found so far, it looks like RadASM is right, but I was wondering what you moved on to in terms of which widget/gadget you used to display your actual calendar.
If you haven't found it yet, you may be looking for this:
https://developers.google.com/google-apps/calendar/gadgets/event/
Please let me know what you went with.
RadASM is right. Google Calendar API provides well structured data for the calendars and calendar events, allowing data manipulation, too. Desiring your custom layout, you need to take care of it.
Here is a detailed explanatory article with full demo code within a single HTML file - Easy and compact access to your Google calendars.

google analytics api in php website

I am creating a custom reporting website, where I want to show live data from google analytics and accordingly the data in my website will change. I want it to be automated and dynamic, like whenever the data changes in GA, i want it to be automatically changed in our website, which will be shown to our clients to show the performance of our websites.
I am guessing this can be achieved by some api calling from php, xml returned values and showing those data on our website along with images.
i would appreciate if anyone could give me more info on how to start working on this.
Google Analytics has an official API. They don't seem to have ready-made PHP examples, but the XML sources should be easy to query. Not sure how "live" GA's data is, though - it could be that it is not possible to do stuff live tracking of visitors.

How to set up a database and API web page to accept POST updates from iPhone?

I am developing an iPhone app, which now can update Twitter account with GPS coordinates in real-time, by the Twitter API link: http://username:password#twitter.com/statuses/update.xml , and I am looking at how to make my own database to accept updates from iPhone, via a similar API page.
It seems a .php page can serve as the API, and MySQL can serve as the database.
What are the good ways of doing it? Any template code and tutorial please?
Try one of these:
http://www.webresourcesdepot.com/how-to-create-an-api-10-tutorials/
Thanks for the answer. I found the php page just need code like
$userid=$_POST["userid"];
$companyid=$_POST["companyid"];
$phoneid=$_POST["phoneid"];
to receive POST from the iphone app.

Categories