File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change 1111 "require" : {
1212 "php" : " ^8.0" ,
1313 "magento-hackathon/magento-composer-installer" : " *" ,
14- "hirale/openmage-redis-queue" : " *"
14+ "hirale/openmage-redis-queue" : " *" ,
15+ "jaybizzle/crawler-detect" : " ^1.2"
1516 },
1617 "authors" : [
1718 {
Original file line number Diff line number Diff line change 11<?php
22
3+ use Jaybizzle \CrawlerDetect \CrawlerDetect ;
4+
35class Hirale_GAMeasurementProtocol_Model_Observer
46{
57 protected $ helper ;
68 protected $ gaHelper ;
79 protected $ queue ;
810 protected $ baseEventData ;
9- protected $ isBot ;
11+ protected $ CrawlerDetect ;
1012
1113 public function __construct ()
1214 {
1315 $ this ->helper = Mage::helper ('gameasurementprotocol ' );
1416 $ this ->gaHelper = Mage::helper ('googleanalytics ' );
1517 $ this ->queue = Mage::getModel ('hirale_queue/task ' );
18+ $ this ->CrawlerDetect = new CrawlerDetect ();
1619 }
1720
1821 public function generateClientId (Varien_Event_Observer $ observer )
@@ -22,11 +25,7 @@ public function generateClientId(Varien_Event_Observer $observer)
2225
2326 protected function isBot ()
2427 {
25- if (preg_match ('/bot|crawl|slurp|spider|GeedoProductSearch|mediapartners/i ' , Mage::helper ('core/http ' )->getHttpUserAgent ())) {
26- return true ;
27- } else {
28- return false ;
29- }
28+ return $ this ->CrawlerDetect ->isCrawler (Mage::helper ('core/http ' )->getHttpUserAgent ());
3029 }
3130
3231 protected function canSend ()
You can’t perform that action at this time.
0 commit comments