public function getPiwik($wrap = true)
    {
        if (Director::isDev() && !Config::inst()->get(PiwikExtension::class, 'show_on_dev')) {
            return false;
        }
        if (Director::isTest() && !Config::inst()->get(PiwikExtension::class, 'show_on_test')) {
            return false;
        }
        if (Director::isLive() && !Config::inst()->get(PiwikExtension::class, 'show_on_live')) {
            return false;
        }

        //used for overwriting defaults in SiteConfig, e.g. for different SiteIDs in a Subsite installation
        $currentSiteConfig = Controller::curr()->hasMethod('getSiteConfig')
            ? Controller::curr()->getSiteConfig()
            : SiteConfig::current_site_config();


        $data = [
            'WrapInJsTags' => $wrap,
            'URL' => Config::inst()->get(PiwikExtension::class, 'piwik_server'),
            'SiteID' => Config::inst()->get(PiwikExtension::class, 'piwik_site_id'),
            'SiteConfig' => $currentSiteConfig
        ];

        return ArrayData::create($data)->renderWith(['Netwerkstatt\\Piwik\\Piwik']);
    }
public function getPiwik($wrap = true)
    {
        if (Director::isDev() && !Config::inst()->get(PiwikExtension::class, 'show_on_dev')) {
            return false;
        }
        if (Director::isTest() && !Config::inst()->get(PiwikExtension::class, 'show_on_test')) {
            return false;
        }
        if (Director::isLive() && !Config::inst()->get(PiwikExtension::class, 'show_on_live')) {
            return false;
        }

        //used for overwriting defaults in SiteConfig, e.g. for different SiteIDs in a Subsite installation
        $currentSiteConfig = Controller::curr()->hasMethod('getSiteConfig')
            ? Controller::curr()->getSiteConfig()
            : SiteConfig::current_site_config();


        $data = [
            'WrapInJsTags' => $wrap,
            'URL' => Config::inst()->get(PiwikExtension::class, 'piwik_server'),
            'SiteID' => Config::inst()->get(PiwikExtension::class, 'piwik_site_id'),
            'SiteConfig' => $currentSiteConfig
        ];

        return ArrayData::create($data)->renderWith(['Netwerkstatt\\Piwik\\Piwik']);
    }
public function getPiwik ( $ wrap = true ) { if ( Director :: isDev ( ) && ! Config :: inst ( ) -> get ( PiwikExtension :: class , 'show_on_dev' ) ) { return false ; } if ( Director :: isTest ( ) && ! Config :: inst ( ) -> get ( PiwikExtension :: class , 'show_on_test' ) ) { return false ; } if ( Director :: isLive ( ) && ! Config :: inst ( ) -> get ( PiwikExtension :: class , 'show_on_live' ) ) { return false ; } //used for overwriting defaults in SiteConfig, e.g. for different SiteIDs in a Subsite installation $ currentSiteConfig = Controller :: curr ( ) -> hasMethod ( 'getSiteConfig' ) ? Controller :: curr ( ) -> getSiteConfig ( ) : SiteConfig :: current_site_config ( ) ; $ data = [ 'WrapInJsTags' => $ wrap , 'URL' => Config :: inst ( ) -> get ( PiwikExtension :: class , 'piwik_server' ) , 'SiteID' => Config :: inst ( ) -> get ( PiwikExtension :: class , 'piwik_site_id' ) , 'SiteConfig' => $ currentSiteConfig ] ; return ArrayData :: create ( $ data ) -> renderWith ( [ 'Netwerkstatt\\Piwik\\Piwik' ] ) ; }
generates piwik tracking code out of config vars and Piwik.ss template
@param $wrap wrap inside <script> tags, e.g. for templates
generates piwik tracking code out of config vars and Piwik . ss template