Пример #1
0
        public Hashtable get(int idSite, PiwikPeriod period, PiwikDate date, string segment = null)
        {
            Parameter[] parameters =
            {
                new SimpleParameter("idSite", idSite),
                new PeriodParameter("period", period),
                new PiwikDateParameter("date", date),
                new SimpleParameter("segment", segment),
            };

            return this.sendRequest<Hashtable>("get", new List<Parameter>(parameters));
        }
Пример #2
0
        public Object GetUniqueVisitors(int idSite, PiwikPeriod period, PiwikDate date, string segment = null)
        {
            Parameter[] parameters = 
            {
                new SimpleParameter("idSite", idSite),
                new PeriodParameter("period", period),
                new PiwikDateParameter("date", date),
                new SimpleParameter("segment", segment),
            };

            if (PiwikPeriod.isMultipleDates(period, date))
            {
                return sendRequest<Hashtable>("getUniqueVisitors", new List<Parameter>(parameters));
            }

            return sendRequest<ArrayList>("getUniqueVisitors", new List<Parameter>(parameters));
        }
Пример #3
0
        public Object GetNumberOfVisitsByVisitCount(int idSite, PiwikPeriod period, PiwikDate date, string segment = null)
        {
            Parameter[] parameters = 
            {
                new SimpleParameter("idSite", idSite),
                new PeriodParameter("period", period),
                new PiwikDateParameter("date", date),
                new SimpleParameter("segment", segment),
            };

            if (PiwikPeriod.isMultipleDates(period, date))
            {
                return this.sendRequest<Hashtable>("getNumberOfVisitsByVisitCount ", new List<Parameter>(parameters));
            }
            else
            {
                return this.sendRequest<ArrayList>("getNumberOfVisitsByVisitCount ", new List<Parameter>(parameters));
            }
        }
Пример #4
0
        public Object getWebsites(int idSite, PiwikPeriod period, PiwikDate date, string segment = null, Boolean expanded = false)
        {
            Parameter[] parameters =
            {
                new SimpleParameter("idSite", idSite),
                new PeriodParameter("period", period),
                new PiwikDateParameter("date", date),
                new SimpleParameter("segment", segment),
                new SimpleParameter("expanded", expanded),
            };

            if (PiwikPeriod.isMultipleDates(period, date))
            {
                return this.sendRequest<Hashtable>("getWebsites", new List<Parameter>(parameters));
            }
            else
            {
                return this.sendRequest<ArrayList>("getWebsites", new List<Parameter>(parameters));
            }
        }
Пример #5
0
        public Object getRefererType(int idSite, PiwikPeriod period, PiwikDate date, string segment = null, RefererType refererType = null)
        {
            Parameter[] parameters =
            {
                new SimpleParameter("idSite", idSite),
                new PeriodParameter("period", period),
                new PiwikDateParameter("date", date),
                new SimpleParameter("segment", segment),
                new RefererTypeParameter("typeReferer", refererType),
            };

            if (PiwikPeriod.isMultipleDates(period, date))
            {
                return this.sendRequest<Hashtable>("getRefererType", new List<Parameter>(parameters));
            }
            else
            {
                return this.sendRequest<ArrayList>("getRefererType", new List<Parameter>(parameters));
            }
        }
Пример #6
0
        public Object getMobileOS(int idSite, PiwikPeriod period, PiwikDate date)
        {
            List<String> mobileOS = new List<String>();
            mobileOS.Add("IPH"); // iPhone
            mobileOS.Add("AND"); // Android
            mobileOS.Add("IPD"); // iPod
            mobileOS.Add("IPA"); // iPad
            mobileOS.Add("BLB"); // Blackberry
            mobileOS.Add("WP7"); // Windows Phone 7
            mobileOS.Add("W65"); // Windows Mobile 6.5
            mobileOS.Add("W61"); // Windows Mobile 6.1
            mobileOS.Add("WOS"); // Palm webOS
            mobileOS.Add("POS"); // Palm OS
            mobileOS.Add("QNX"); // QNX & RIM Tablet OS
            mobileOS.Add("SYM"); // Symbian OS

            String segment = String.Empty;
            foreach (String OS in mobileOS)
            {
                segment += "operatingSystem==" + OS + ",";
            }

            return this.getOS(idSite, period, date, segment);
        }
Пример #7
0
        /// <summary>
        /// Update an existing scheduled report
        /// </summary>
        /// <param name="idReport">The ID of the report to update</param>
        /// <param name="idSite">ID of the piwik site</param>
        /// <param name="description">Description of the report</param>
        /// <param name="period">A piwik period</param>
        /// <param name="hour">Defines the hour at which the report will be sent</param>
        /// <param name="reportType">The report type</param>
        /// <param name="reportFormat">The report format</param>
        /// <param name="includedStatistics">The included statistics</param>
        /// <param name="emailMe">true if the report should be sent to the own user</param>
        /// <param name="additionalEmails">A string array of additional email recipients</param>
        /// <returns>True if update was successful</returns>
        public Boolean updateReport(
            int idReport,
            int idSite,
            string description,
            PiwikPeriod period,
            int hour,
            ReportType reportType,
            ReportFormat reportFormat,
            List<Statistic> includedStatistics,
            Boolean emailMe,
            string[] additionalEmails = null
            )
        {
            Dictionary<string, Object> additionalParameters = new Dictionary<string, Object>()
            {
                { "emailMe", emailMe.ToString().ToLower() },
                { "displayFormat", 1 },
                { "additionalEmails", additionalEmails }
            };

            Parameter[] p = 
            {
                new SimpleParameter("idReport", idReport),
                new SimpleParameter("idSite", idSite),
                new SimpleParameter("description", description),
                new PeriodParameter("period", period),
                new SimpleParameter("hour", hour),
                new SimpleParameter("reportType", reportType.ToString()),
                new SimpleParameter("reportFormat", reportFormat.ToString()),                                
                new ArrayParameter("reports", includedStatistics.Select(i => i.ToString()).ToArray(), false),
                new DictionaryParameter("parameters", additionalParameters)
            };

            return this.sendRequest<Boolean>("updateReport", new List<Parameter>(p));
        }
Пример #8
0
 public static Boolean isMultipleDates(PiwikPeriod period, PiwikDate date)
 {
     return
         !String.Equals(PiwikPeriod.RANGE.getPeriod(), period.getPeriod()) &&
         (date is AbsoluteRangeDate || date is RelativeRangeDate);
 }
Пример #9
0
 public PeriodParameter(string name, PiwikPeriod period) : base(name)
 {
     this.period = period;
 }
Пример #10
0
 public static Boolean isMultipleDates(PiwikPeriod period, PiwikDate date)
 {
     return
         (!String.Equals(PiwikPeriod.RANGE.getPeriod(), period.getPeriod()) &&
          (date is AbsoluteRangeDate || date is RelativeRangeDate));
 }