diff --git a/config/slmgoogleanalytics.global.php.dist b/config/slmgoogleanalytics.global.php similarity index 93% rename from config/slmgoogleanalytics.global.php.dist rename to config/slmgoogleanalytics.global.php index a91ebab..077f3d2 100644 --- a/config/slmgoogleanalytics.global.php.dist +++ b/config/slmgoogleanalytics.global.php @@ -57,6 +57,11 @@ * False by default, with "true" you enable this feature. */ // 'enable_display_advertising' => false, + + /** + * Set the container name to be used for the Google Analytics code + */ + //'container_name' => 'InlineScript', ); /** diff --git a/src/SlmGoogleAnalytics/Service/GoogleAnalyticsFactory.php b/src/SlmGoogleAnalytics/Service/GoogleAnalyticsFactory.php index 9577aa1..d1c3163 100644 --- a/src/SlmGoogleAnalytics/Service/GoogleAnalyticsFactory.php +++ b/src/SlmGoogleAnalytics/Service/GoogleAnalyticsFactory.php @@ -51,6 +51,13 @@ public function createService(ServiceLocatorInterface $serviceLocator) $script = $sm->get('SlmGoogleAnalytics\Service\ScriptFactory'); $helper = new GoogleAnalytics($script); + $config = $sm->get('config'); + $config = $config['google_analytics']; + + if (isset($config['container_name'])) { + $helper->setContainerName($config['container_name']); + } + return $helper; } }