Conditions | 1 |
Paths | 1 |
Total Lines | 8 |
Code Lines | 4 |
Lines | 0 |
Ratio | 0 % |
Tests | 4 |
CRAP Score | 1 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php namespace StudioBonito\SilverStripe\GoogleAnalytics\TemplateGlobalProviders; |
||
23 | 3 | public static function getGoogleAnalyticsScript() |
|
24 | { |
||
25 | 3 | $siteConfigService = Injector::inst()->get('SiteConfig'); |
|
26 | |||
27 | 3 | $siteConfig = $siteConfigService->current_site_config(); |
|
28 | |||
29 | 3 | return "<script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[ r ]=i[ r ]||function(){(i[ r ].q=i[ r ].q||[]).push(arguments)},i[ r ].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');ga('create', '{$siteConfig->GoogleAnalyticsTrackingID}', 'auto');ga('send', 'pageview');</script>"; |
|
30 | } |
||
31 | } |