Skip to content

Commit

Permalink
Merge pull request #41 from juriansluiman/feature/container-in-config
Browse files Browse the repository at this point in the history
Define container name in configuration file

closes #33
  • Loading branch information
Jurian Sluiman committed Jun 15, 2014
2 parents 44a00b1 + 7de9297 commit d1554e0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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',
);

/**
Expand Down
7 changes: 7 additions & 0 deletions src/SlmGoogleAnalytics/Service/GoogleAnalyticsFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

0 comments on commit d1554e0

Please sign in to comment.