Welcome Guest, Not a member yet? Register   Sign In
MeNeedz Visitor tracking
#21

[eluser]davidbehler[/eluser]
I doubt that this script is much of a performance killer. There are a maximum of 4 queries per page view of which 2 are inserts. Given well placed indices, which don't exist yet, this shouldn't pose a problem.

But again: I don't want to compete with Google Analytics or any other tracking software. This is purely for fun...atleast so far.
#22

[eluser]Sbioko[/eluser]
Oh, I have an idea. What if you create a JavaScript script, which will do all the statistics stuff and php will just insert data from JavaScript to the database? It will be faster!
#23

[eluser]davidbehler[/eluser]
And that again wouldn't work if the user has disabled Javascript...

As long as this is a fun-project I will not worry too much about possible speed issues.
#24

[eluser]masson[/eluser]
Hey,

Just what i was looking for, would you mind sharing a sample view file ?. Where you output the content from DB ?.

I would be very interested in that!.
#25

[eluser]igniteflow[/eluser]
I made a simple tracker, thought I'd post it here as it might be useful as a starting block or for people who don't need a fully featured version. I'm new to CI, so please point out any errors/bad practices, I'd appreciate it...

SQL

Code:
CREATE TABLE IF NOT EXISTS `tracker` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `ip` varchar(20) NOT NULL,
  `browser` varchar(500) NOT NULL,
  `url` varchar(500) NOT NULL,
  `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;


I put this in the view file:

Code:
<?php
  $tracker['id'] = '';
  $tracker['ip'] = $this->input->ip_address();
  $tracker['browser'] = $this->input->user_agent();
  $tracker['url'] = $_SERVER['REQUEST_URI'];
  
  // insert data to db      
  $this->db->insert('tracker', $tracker);
?>
#26

[eluser]davidbehler[/eluser]
Well, looks like a pretty basic version of my code.
#27

[eluser]igniteflow[/eluser]
Yes it is waldmeister, I like your thread, but I'm new to CI only been using it since Monday, so thought some other beginners might appreciate a super simple example to get them started and work up to yours later.
#28

[eluser]masson[/eluser]
waldmeister, would you mind sharing a sample view file where you output the content stats from database?. I'm having issues with that one but everything else works perfectly... Thank you so much for sharing...
#29

[eluser]mrwilson1[/eluser]
Waldmiester, this is an excellent script. The only change I will make to it is a request to Stop forum spam to see if the visitor is a spammer and then to block his next visit

Well done from a perpetual beginner
#30

[eluser]tolinho[/eluser]
Hi.
I see this thread's last update has been 3years ago...
Anyway...

I'm testing codeigniter and I found "davidbehler's" script.
I managed to get it tracking the visits.
If I check the database all data is there.

Now on my dashboard I'm tryng to get the results
I added:
$this->load->library('user_agent');
$this->load->model('Tracker_model');
//$this->tracker_model->get_hits(FALSE, FALSE, TRUE);
$this->tracker_model->get_hits();

but I always bet error:

A PHP Error was encountered

Severity: Notice

Message: Undefined property: Dashboard::$tracker_model

Filename: controllers/dashboard.php

Line Number: 22

And I don't know how to solve this?

Can anyone help please?
Thanks




Theme © iAndrew 2016 - Forum software by © MyBB