public function pageViewAnalytics($url = "", $title = "") { $result = null; $analytics = $this->analytics(); if ($analytics) { if ($url == "") { $url = craft()->request->url; } /* -- We want to send just a path to GA for page views */ if (UrlHelper::isAbsoluteUrl($url)) { $urlParts = parse_url($url); if (isset($urlParts['path'])) { $url = $urlParts['path']; } else { $url = "/"; } if (isset($urlParts['query'])) { $url = $url . "?" . $urlParts['query']; } } /* -- We don't want to send protocol-relative URLs either */ if (UrlHelper::isProtocolRelativeUrl($url)) { $url = substr($url, 1); } /* -- Strip the query string if that's the global config setting */ $settings = craft()->plugins->getPlugin('instantanalytics')->getSettings(); if (isset($settings) && isset($settings['stripQueryString']) && $settings['stripQueryString']) { $url = UrlHelper::stripQueryString($url); } /* -- Prepare the Analytics object, and send the pageview */ $analytics->setDocumentPath($url)->setDocumentTitle($title); $result = $analytics; InstantAnalyticsPlugin::log("Created sendPageView for `" . $url . "` - `" . $title . "`", LogLevel::Info, false); } return $result; }