How do I count unique page view count to my web page using Cakephp 3.0?

446 Views Asked by At

I'm trying to implement total unique page view count to my webpage, Any one knows that how to do that just give me an idea to implement using CakePHP 3.0

2

There are 2 best solutions below

1
Ashok On BEST ANSWER

create table for page view

ex:

CREATE TABLE `pageview` (
 `id` int(11) NOT NULL AUTO_INCREMENT,
 `page` text NOT NULL,
 `userip` text NOT NULL,
 PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1

then store visitor ip address into your table using

// gets the user IP Address
  $userip=$_SERVER['REMOTE_ADDR'];
0
tarikul05 On

You can do it by checking both COOKIE and IP
There is a Plugins written by CakeManager which give those facility with proper functionality

https://github.com/cakemanager/cakephp-analyzer