Ja użyłem u siebie zbiorczej tabeli statystyk. Może to Ci pomoże:
Kod
CREATE TABLE `statistics` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`pageable_id` INT(10) UNSIGNED NOT NULL,
`pageable_type` VARCHAR(255) NOT NULL COLLATE 'utf8_unicode_ci',
`ip` VARCHAR(32) NOT NULL COLLATE 'utf8_unicode_ci',
`user_agent` VARCHAR(255) NOT NULL COLLATE 'utf8_unicode_ci',
`created_at` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
`updated_at` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
`bot` TINYINT(1) NOT NULL,
`referrer` VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8_unicode_ci',
PRIMARY KEY (`id`)
)
COLLATE='utf8_unicode_ci'
ENGINE=InnoDB
INSERT INTO `statistics` (`pageable_id`, `pageable_type`, `ip`, `user_agent`, `created_at`, `updated_at`, `bot`, `referrer`) VALUES (1, 'App\\Models\\Category', '149.202.49.56', 'Mozilla/5.0 (compatible; MJ12bot/v1.4.5; http://www.majestic12.co.uk/bot.php?+)', '2015-12-30 22:36:28', '2015-12-30 22:36:28', 1, NULL);
INSERT INTO `statistics` (`pageable_id`, `pageable_type`, `ip`, `user_agent`, `created_at`, `updated_at`, `bot`, `referrer`) VALUES (4, 'App\\Models\\Category', '149.202.49.56', 'Mozilla/5.0 (compatible; MJ12bot/v1.4.5; http://www.majestic12.co.uk/bot.php?+)', '2015-12-30 22:36:30', '2015-12-30 22:36:30', 1, NULL);
INSERT INTO `statistics` (`pageable_id`, `pageable_type`, `ip`, `user_agent`, `created_at`, `updated_at`, `bot`, `referrer`) VALUES (3, 'App\\Models\\Category', '149.202.49.56', 'Mozilla/5.0 (compatible; MJ12bot/v1.4.5; http://www.majestic12.co.uk/bot.php?+)', '2015-12-30 22:36:32', '2015-12-30 22:36:32', 1, NULL);
INSERT INTO `statistics` (`pageable_id`, `pageable_type`, `ip`, `user_agent`, `created_at`, `updated_at`, `bot`, `referrer`) VALUES (11, 'App\\Models\\Category', '149.202.49.56', 'Mozilla/5.0 (compatible; MJ12bot/v1.4.5; http://www.majestic12.co.uk/bot.php?+)', '2015-12-30 22:36:33', '2015-12-30 22:36:33', 1, NULL);
INSERT INTO `statistics` (`pageable_id`, `pageable_type`, `ip`, `user_agent`, `created_at`, `updated_at`, `bot`, `referrer`) VALUES (46, 'App\\Models\\Post', '149.202.49.56', 'Mozilla/5.0 (compatible; MJ12bot/v1.4.5; http://www.majestic12.co.uk/bot.php?+)', '2015-12-30 22:36:35', '2015-12-30 22:36:35', 1, NULL);
INSERT INTO `statistics` (`pageable_id`, `pageable_type`, `ip`, `user_agent`, `created_at`, `updated_at`, `bot`, `referrer`) VALUES (43, 'App\\Models\\Post', '149.202.49.56', 'Mozilla/5.0 (compatible; MJ12bot/v1.4.5; http://www.majestic12.co.uk/bot.php?+)', '2015-12-30 22:36:40', '2015-12-30 22:36:40', 1, NULL);
INSERT INTO `statistics` (`pageable_id`, `pageable_type`, `ip`, `user_agent`, `created_at`, `updated_at`, `bot`, `referrer`) VALUES (58, 'App\\Models\\Post', '149.202.49.56', 'Mozilla/5.0 (compatible; MJ12bot/v1.4.5; http://www.majestic12.co.uk/bot.php?+)', '2015-12-30 22:36:43', '2015-12-30 22:36:43', 1, NULL);
INSERT INTO `statistics` (`pageable_id`, `pageable_type`, `ip`, `user_agent`, `created_at`, `updated_at`, `bot`, `referrer`) VALUES (44, 'App\\Models\\Post', '149.202.49.56', 'Mozilla/5.0 (compatible; MJ12bot/v1.4.5; http://www.majestic12.co.uk/bot.php?+)', '2015-12-30 22:36:59', '2015-12-30 22:36:59', 1, NULL);
INSERT INTO `statistics` (`pageable_id`, `pageable_type`, `ip`, `user_agent`, `created_at`, `updated_at`, `bot`, `referrer`) VALUES (47, 'App\\Models\\Post', '149.202.49.56', 'Mozilla/5.0 (compatible; MJ12bot/v1.4.5; http://www.majestic12.co.uk/bot.php?+)', '2015-12-30 22:37:00', '2015-12-30 22:37:00', 1, NULL);
INSERT INTO `statistics` (`pageable_id`, `pageable_type`, `ip`, `user_agent`, `created_at`, `updated_at`, `bot`, `referrer`) VALUES (12, 'App\\Models\\Post', '149.202.49.56', 'Mozilla/5.0 (compatible; MJ12bot/v1.4.5; http://www.majestic12.co.uk/bot.php?+)', '2015-12-30 22:37:03', '2015-12-30 22:37:03', 1, NULL);
INSERT INTO `statistics` (`pageable_id`, `pageable_type`, `ip`, `user_agent`, `created_at`, `updated_at`, `bot`, `referrer`) VALUES (66, 'App\\Models\\Tag', '149.202.49.56', 'Mozilla/5.0 (compatible; MJ12bot/v1.4.5; http://www.majestic12.co.uk/bot.php?+)', '2015-12-30 22:37:05', '2015-12-30 22:37:05', 1, NULL);
INSERT INTO `statistics` (`pageable_id`, `pageable_type`, `ip`, `user_agent`, `created_at`, `updated_at`, `bot`, `referrer`) VALUES (64, 'App\\Models\\Tag', '149.202.49.56', 'Mozilla/5.0 (compatible; MJ12bot/v1.4.5; http://www.majestic12.co.uk/bot.php?+)', '2015-12-30 22:37:07', '2015-12-30 22:37:07', 1, NULL);
INSERT INTO `statistics` (`pageable_id`, `pageable_type`, `ip`, `user_agent`, `created_at`, `updated_at`, `bot`, `referrer`) VALUES (25, 'App\\Models\\Tag', '149.202.49.56', 'Mozilla/5.0 (compatible; MJ12bot/v1.4.5; http://www.majestic12.co.uk/bot.php?+)', '2015-12-30 22:37:08', '2015-12-30 22:37:08', 1, NULL);
INSERT INTO `statistics` (`pageable_id`, `pageable_type`, `ip`, `user_agent`, `created_at`, `updated_at`, `bot`, `referrer`) VALUES (13, 'App\\Models\\Tag', '149.202.49.56', 'Mozilla/5.0 (compatible; MJ12bot/v1.4.5; http://www.majestic12.co.uk/bot.php?+)', '2015-12-30 22:37:10', '2015-12-30 22:37:10', 1, NULL);
pagable_id - ID rekordu z tabeli której dotyczy odwiedzenie
pagable_type - typ np. tag, post, kategoria