コード例 #1
0
        private static void TrackAction(HttpContext context, Config config, ActionType type, string userAgent, string clientIp, string url, string urlReferrer)
        {
            try
            {
                if (config.PiwikConfig.Enabled)
                {
                    PiwikTracker tracker = new PiwikTracker(config.PiwikConfig.SiteId, config.PiwikConfig.Url, context);

                    tracker.SetUserAgent(userAgent);

                    tracker.SetIp(clientIp);
                    tracker.SetTokenAuth(config.PiwikConfig.TokenAuth);

                    // Get Referral
                    if (!string.IsNullOrEmpty(urlReferrer))
                    {
                        tracker.SetUrlReferrer(urlReferrer);
                    }

                    if (!string.IsNullOrEmpty(url))
                    {
                        tracker.SetUrl(url);
                    }

                    tracker.DoTrackAction(url, type);
                }
            }
            catch (Exception ex)
            {
            }
        }
コード例 #2
0
        /// <summary>
        /// Records a file download
        /// </summary>
        static private void TrackDownload()
        {
            var piwikTracker = new PiwikTracker(SiteId, PiwikBaseUrl);

            piwikTracker.SetUserAgent(UA);

            var response = piwikTracker.DoTrackAction("http://piwik.org/path/again/latest.zip", ActionType.Download);

            DisplayDebugInfo(response);
        }
コード例 #3
0
        /// <summary>
        /// Records a clicked link
        /// </summary>
        static private void TrackLink()
        {
            var piwikTracker = new PiwikTracker(SiteId, PiwikBaseUrl);

            piwikTracker.SetUserAgent(UA);

            var response = piwikTracker.DoTrackAction("http://dev.piwik.org/svn", ActionType.Link);

            DisplayDebugInfo(response);
        }