How do i track visits to a single page and save info to the database


(Johnny) #1

Im trying to save page unique and all hits to a page per day and then get a total for a give month range on the first of each month.
i tried looking at the api and that seems to give me a nifty month range and save this info to mysql database.

my_doamin/analytics/index.php?module=API&method=Actions.getPageUrl&pageUrl=/single_event_page.php?id=64&idSite=1&period=range&date=2013-12-01,2014-01-01&format=xml&token_auth=xxx

returns
/single_event_page.php?id=64
<nb_visits>1</nb_visits>
<nb_hits>2</nb_hits>

this works pretty well.
but im looking to do a group of urls, and id like to make this a php page, so it makes a report.

i looked at goals but i couldn’t get it to return any of my data like this api url did. so it looks like the api call is the way to go.

or is there a better way?

im looking to see daily and on the first of each month the last months info, i was thinking of generating a cron job for this.
ive noticed theres sop many ways to do things i wanted to make sure im doing this right.

looking through some of the examples and things in the forums and api docs was not very helpful.

thank you in advance for any code or help you may provide.
Johnny