CodeIgniter Forums
Visitors stats using CI - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Visitors stats using CI (/showthread.php?tid=38069)



Visitors stats using CI - El Forum - 01-29-2011

[eluser]Mantero[/eluser]
how to count a visitors when they visit our site? what's the idea behind that?

*edit the title


Visitors stats using CI - El Forum - 01-29-2011

[eluser]BrianJM[/eluser]
Clicky
Google Analytics

Lots of others as well...


Visitors stats using CI - El Forum - 01-29-2011

[eluser]Mantero[/eluser]
erm sorry, I mean using CI, is there a way to do that instead using those already built tools?

I need to create my own visitors stat for my application


Visitors stats using CI - El Forum - 01-31-2011

[eluser]Unknown[/eluser]
look at http://ellislab.com/forums/viewthread/81644/P0/


Visitors stats using CI - El Forum - 01-31-2011

[eluser]InsiteFX[/eluser]
If you need to keep track of all visitors to site then you will need to
log them in as a visitor!

You will need an auth library and code to do this.

table vistors:
Code:
CREATE TABLE `visitors_online` (
  `ip_address`    varchar(16)             NOT NULL    DEFAULT '0',
  `timestamp`    int(11)        unsigned    NOT NULL,
  PRIMARY KEY (`ip_address`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ;

When someone accesses your site you log them in as a vistor automatically!
Then if they login to your system you move them to the table below.
Also you need to log them into the auth users table and set the session data.

Table users_online:
Code:
CREATE TABLE `users_online` (
  `user_name`    varchar(40),
  `timestamp`    int(11)            unsigned    NOT NULL,
  PRIMARY KEY (`user_name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ;

I think I should really code this complete auth library up sometime!

InsiteFX