public function getJavascriptTag($idSite, $piwikUrl = '', $mergeSubdomains = false, $groupPageTitlesByDomain = false,
                                     $mergeAliasUrls = false, $visitorCustomVariables = false, $pageCustomVariables = false,
                                     $customCampaignNameQueryParam = false, $customCampaignKeywordParam = false,
                                     $doNotTrack = false, $disableCookies = false, $trackNoScript = false,
                                     $crossDomain = false, $forceMatomoEndpoint = false)
    {
        Piwik::checkUserHasViewAccess($idSite);

        if (empty($piwikUrl)) {
            $piwikUrl = SettingsPiwik::getPiwikUrl();
        }

        // Revert the automatic encoding
        // TODO remove that when https://github.com/piwik/piwik/issues/4231 is fixed
        $piwikUrl = Common::unsanitizeInputValue($piwikUrl);
        $visitorCustomVariables = Common::unsanitizeInputValues($visitorCustomVariables);
        $pageCustomVariables = Common::unsanitizeInputValues($pageCustomVariables);
        $customCampaignNameQueryParam = Common::unsanitizeInputValue($customCampaignNameQueryParam);
        $customCampaignKeywordParam = Common::unsanitizeInputValue($customCampaignKeywordParam);

        $generator = new TrackerCodeGenerator();
        if ($forceMatomoEndpoint) {
            $generator->forceMatomoEndpoint();
        }

        $code = $generator->generate($idSite, $piwikUrl, $mergeSubdomains, $groupPageTitlesByDomain,
                                     $mergeAliasUrls, $visitorCustomVariables, $pageCustomVariables,
                                     $customCampaignNameQueryParam, $customCampaignKeywordParam,
                                     $doNotTrack, $disableCookies, $trackNoScript, $crossDomain);
        $code = str_replace(array('<br>', '<br />', '<br/>'), '', $code);
        return $code;
    }
public function getJavascriptTag($idSite, $piwikUrl = '', $mergeSubdomains = false, $groupPageTitlesByDomain = false,
                                     $mergeAliasUrls = false, $visitorCustomVariables = false, $pageCustomVariables = false,
                                     $customCampaignNameQueryParam = false, $customCampaignKeywordParam = false,
                                     $doNotTrack = false, $disableCookies = false, $trackNoScript = false,
                                     $crossDomain = false, $forceMatomoEndpoint = false)
    {
        Piwik::checkUserHasViewAccess($idSite);

        if (empty($piwikUrl)) {
            $piwikUrl = SettingsPiwik::getPiwikUrl();
        }

        // Revert the automatic encoding
        // TODO remove that when https://github.com/piwik/piwik/issues/4231 is fixed
        $piwikUrl = Common::unsanitizeInputValue($piwikUrl);
        $visitorCustomVariables = Common::unsanitizeInputValues($visitorCustomVariables);
        $pageCustomVariables = Common::unsanitizeInputValues($pageCustomVariables);
        $customCampaignNameQueryParam = Common::unsanitizeInputValue($customCampaignNameQueryParam);
        $customCampaignKeywordParam = Common::unsanitizeInputValue($customCampaignKeywordParam);

        $generator = new TrackerCodeGenerator();
        if ($forceMatomoEndpoint) {
            $generator->forceMatomoEndpoint();
        }

        $code = $generator->generate($idSite, $piwikUrl, $mergeSubdomains, $groupPageTitlesByDomain,
                                     $mergeAliasUrls, $visitorCustomVariables, $pageCustomVariables,
                                     $customCampaignNameQueryParam, $customCampaignKeywordParam,
                                     $doNotTrack, $disableCookies, $trackNoScript, $crossDomain);
        $code = str_replace(array('<br>', '<br />', '<br/>'), '', $code);
        return $code;
    }
public function getJavascriptTag ( $ idSite , $ piwikUrl = '' , $ mergeSubdomains = false , $ groupPageTitlesByDomain = false , $ mergeAliasUrls = false , $ visitorCustomVariables = false , $ pageCustomVariables = false , $ customCampaignNameQueryParam = false , $ customCampaignKeywordParam = false , $ doNotTrack = false , $ disableCookies = false , $ trackNoScript = false , $ crossDomain = false , $ forceMatomoEndpoint = false ) { Piwik :: checkUserHasViewAccess ( $ idSite ) ; if ( empty ( $ piwikUrl ) ) { $ piwikUrl = SettingsPiwik :: getPiwikUrl ( ) ; } // Revert the automatic encoding // TODO remove that when https://github.com/piwik/piwik/issues/4231 is fixed $ piwikUrl = Common :: unsanitizeInputValue ( $ piwikUrl ) ; $ visitorCustomVariables = Common :: unsanitizeInputValues ( $ visitorCustomVariables ) ; $ pageCustomVariables = Common :: unsanitizeInputValues ( $ pageCustomVariables ) ; $ customCampaignNameQueryParam = Common :: unsanitizeInputValue ( $ customCampaignNameQueryParam ) ; $ customCampaignKeywordParam = Common :: unsanitizeInputValue ( $ customCampaignKeywordParam ) ; $ generator = new TrackerCodeGenerator ( ) ; if ( $ forceMatomoEndpoint ) { $ generator -> forceMatomoEndpoint ( ) ; } $ code = $ generator -> generate ( $ idSite , $ piwikUrl , $ mergeSubdomains , $ groupPageTitlesByDomain , $ mergeAliasUrls , $ visitorCustomVariables , $ pageCustomVariables , $ customCampaignNameQueryParam , $ customCampaignKeywordParam , $ doNotTrack , $ disableCookies , $ trackNoScript , $ crossDomain ) ; $ code = str_replace ( array ( '<br>' , '<br />' , '<br/>' ) , '' , $ code ) ; return $ code ; }
Returns the javascript tag for the given idSite.
This tag must be included on every page to be tracked by Matomo

@param int $idSite
@param string $piwikUrl
@param bool $mergeSubdomains
@param bool $groupPageTitlesByDomain
@param bool $mergeAliasUrls
@param bool $visitorCustomVariables
@param bool $pageCustomVariables
@param bool $customCampaignNameQueryParam
@param bool $customCampaignKeywordParam
@param bool $doNotTrack
@param bool $disableCookies
@param bool $trackNoScript
@param bool $forceMatomoEndpoint Whether the Matomo endpoint should be forced if Matomo was installed prior 3.7.0.
@return string The Javascript tag ready to be included on the HTML pages
Returns the javascript tag for the given idSite . This tag must be included on every page to be tracked by Matomo