Jump to content

Retrieve Google Analytics Visits and PageViews with PHP


Recommended Posts

First of all thank you for your answer.


I download this code. http://www.swis.nl/ga/

After that, i use the code bellow retrieve the data.


//session_start for caching, if desired
//get the class
require 'ga/analytics.class.php';
//sign in and grab profile
$analytics = new analytics('david@davidwalsh.name', 'myP@ssw0rd');
//set the date range for which I want stats for (could also be $analytics->setDateRange('YYYY-MM-DD', 'YYYY-MM-DD'))
$analytics->setMonth(date('n'), date('Y'));
//get array of visitors by day
//get array of pageviews by day


In the field $analytics i set my email: test@gmail.com and my password: ''Password"

In the $analytics->setProfileByName(''); i put the UA-21075529-4 of my page.


What i make wrong?  :shrug:

Link to comment
Share on other sites

It shows me an error page. Nothing further.


I don't suppose it crossed your mind to provide that error message to the people you are asking to help you?


I suppose that someone has an analytics account and should be test  it.


Sorry, that sentence makes no sense.


How can you count unique visitors on your web sites?


I'm not sure I could be bothered explaining that to you.

Link to comment
Share on other sites

The error is HTTP 500 (Internal Server Error).


I think that i have something wrong on my login details.


I'm not sure I could be bothered explaining that to you.

I'm sorry. My english is not good.

I make this thread to find an answer. I didnt force anyone help me.  :-\


I believe that someone who tried this code, can help me.

Thank u

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.