Jump to content

Retrieve Google Analytics Visits and PageViews with PHP


Isset1988

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
session_start();
//get the class
require 'ga/analytics.class.php';
//sign in and grab profile
$analytics = new analytics('[email protected]', 'myP@ssw0rd');
$analytics->setProfileByName('davidwalsh.name');
//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
print_r($analytics->getVisitors());
//get array of pageviews by day
print_r($analytics->getPageviews());

 

In the field $analytics i set my email: [email protected] and my password: ''Password"

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

 

What i make wrong?  :shrug:

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.

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.