Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Data.php
Go to the documentation of this file.
1 <?php
10 
11 use \Magento\Store\Model\ScopeInterface;
12 
18 {
22  const XML_PATH_ENABLED = 'google/analytics/experiments';
23 
27  protected $_activeForCmsFlag;
28 
32  protected $_analyticsHelper;
33 
38  public function __construct(
39  \Magento\Framework\App\Helper\Context $context,
40  \Magento\GoogleAnalytics\Helper\Data $analyticsHelper
41  ) {
42  $this->_analyticsHelper = $analyticsHelper;
43  parent::__construct($context);
44  }
45 
52  public function isGoogleExperimentEnabled($store = null)
53  {
54  return (bool)$this->scopeConfig->isSetFlag(self::XML_PATH_ENABLED, ScopeInterface::SCOPE_STORE, $store);
55  }
56 
63  public function isGoogleExperimentActive($store = null)
64  {
65  return $this->isGoogleExperimentEnabled($store) && $this->_analyticsHelper->isGoogleAnalyticsAvailable($store);
66  }
67 }
__construct(\Magento\Framework\App\Helper\Context $context, \Magento\GoogleAnalytics\Helper\Data $analyticsHelper)
Definition: Data.php:38
isGoogleExperimentActive($store=null)
Definition: Data.php:63
isGoogleExperimentEnabled($store=null)
Definition: Data.php:52