private static void GetVisitFrequencyTwoPeriods() { var visitFrequency = new VisitFrequency(); visitFrequency.setTokenAuth("XYZ"); var results = visitFrequency.get( 1, PiwikPeriod.MONTH, RelativeRangeDate.LAST(2) ); Console.WriteLine(results.Count + " results found"); // The request if for multiple periods // Loop over the requested periods foreach (String period in results.Keys) { Console.WriteLine("Data for " + period); var result = (Hashtable)results[period]; // Display visit frequency metrics for the current period Console.WriteLine( result[VisitFrequency.NB_VISITS_RETURNING] + " " + result[VisitFrequency.NB_ACTIONS_RETURNING] + " " + result[VisitFrequency.MAX_ACTIONS_RETURNING] + " " + result[VisitFrequency.SUM_VISIT_LENGTH_RETURNING] + " " + result[VisitFrequency.BOUNCE_COUNT_RETURNING] + " " + result[VisitFrequency.BOUNCE_RATE_RETURNING] + " " + result[VisitFrequency.NB_ACTIONS_PER_VISIT_RETURNING] + " " + result[VisitFrequency.AVG_TIME_ON_SITE_RETURNING] ); } }
private static void GetBrowserMonthLast2() { var userSettings = new UserSettings(); userSettings.setTokenAuth("XYZ"); var results = (Hashtable)userSettings.getBrowser(1, PiwikPeriod.MONTH, RelativeRangeDate.LAST(2)); Console.WriteLine(results.Count + " results found"); // The request if for multiple periods // Loop over the requested periods foreach (String period in results.Keys) { Console.WriteLine("Data for " + period); // Loop over each browser name (ie. LABEL) foreach (Hashtable result in (ArrayList)results[period]) { // Display browser stats Console.WriteLine( result[UserSettings.LABEL] + " " + result[UserSettings.NB_UNIQ_VISITORS] + " " + result[UserSettings.NB_VISITS] + " " + result[UserSettings.NB_ACTIONS] + " " + result[UserSettings.MAX_ACTIONS] + " " + result[UserSettings.SUM_VISIT_LENGTH] + " " + result[UserSettings.BOUNCE_COUNT] + " " + result[UserSettings.NB_VISITS_CONVERTED] + " " + result[UserSettings.SUM_DAILY_NB_UNIQ_VISITORS] + " " + result[UserSettings.LOGO] + " " + result[UserSettings.SHORTLABEL] ); } } }