/// <summary> /// Inserts (creates) a simple Floodlight report for a given Floodlight Configuration ID. /// </summary> /// <param name="userProfileId"> /// The ID number of the DFA user profile to run this request as. /// </param> /// <param name="floodlightConfigId"> /// The Floodlight configuration ID the report is about. /// </param> /// <param name="startDate">The starting date of the report.</param> /// <param name="endDate">The ending date of the report.</param> /// <returns>The newly created report</returns> public Report Insert(long userProfileId, DimensionValue floodlightConfigId, DateTime startDate, DateTime endDate) { Console.WriteLine("================================================================="); Console.WriteLine("Creating a new floodlight report for Floodlight config ID {0}", floodlightConfigId.Value); Console.WriteLine("================================================================="); // Create a report. Report report = new Report(); report.Name = string.Format("API Floodlight Report: Floodlight ID {0}", floodlightConfigId.Value); report.FileName = "api_floodlight_report_files"; // Set the type of report you want to create. Available report types can be found in // the description of the type property: // https://developers.google.com/doubleclick-advertisers/reporting/v1.3/reports report.Type = "FLOODLIGHT"; // Create criteria. var criteria = new Report.FloodlightCriteriaData(); criteria.DateRange = new DateRange { StartDate = DfaReportingDateConverterUtil.convert(startDate), EndDate = DfaReportingDateConverterUtil.convert(endDate) }; // Set the dimensions, metrics, and filters you want in the report. The available // values can be found here: // https://developers.google.com/doubleclick-advertisers/reporting/v1.3/dimensions criteria.Dimensions = new List <SortedDimension> { new SortedDimension { Name = "dfa:floodlightConfigId" }, new SortedDimension { Name = "dfa:activity" }, new SortedDimension { Name = "dfa:advertiser" } }; criteria.MetricNames = new List <string> { "dfa:activityClickThroughConversions", "dfa:activityClickThroughRevenue", "dfa:activityViewThroughConversions", "dfa:activityViewThroughRevenue" }; criteria.DimensionFilters = new List <DimensionValue> { floodlightConfigId }; report.FloodlightCriteria = criteria; Report result = service.Reports.Insert(report, userProfileId).Execute(); Console.WriteLine("Created report with ID \"{0}\" and display name \"{1}\"", result.Id, result.Name); Console.WriteLine(); return(result); }
/// <summary> /// Inserts (creates) a simple Floodlight report for a given Floodlight Configuration ID. /// </summary> /// <param name="userProfileId"> /// The ID number of the DFA user profile to run this request as. /// </param> /// <param name="floodlightConfigId"> /// The Floodlight configuration ID the report is about. /// </param> /// <param name="startDate">The starting date of the report.</param> /// <param name="endDate">The ending date of the report.</param> /// <returns>The newly created report</returns> public Report Insert(long userProfileId, DimensionValue floodlightConfigId, DateTime startDate, DateTime endDate) { Console.WriteLine("================================================================="); Console.WriteLine("Creating a new floodlight report for Floodlight config ID {0}", floodlightConfigId.Value); Console.WriteLine("================================================================="); // Create a report. Report report = new Report(); report.Name = string.Format("API Floodlight Report: Floodlight ID {0}", floodlightConfigId.Value); report.FileName = "api_floodlight_report_files"; // Set the type of report you want to create. Available report types can be found in // the description of the type property: // https://developers.google.com/doubleclick-advertisers/reporting/v1.3/reports report.Type = "FLOODLIGHT"; // Create criteria. var criteria = new Report.FloodlightCriteriaData(); criteria.DateRange = new DateRange { StartDate = DfaReportingDateConverterUtil.convert(startDate), EndDate = DfaReportingDateConverterUtil.convert(endDate) }; // Set the dimensions, metrics, and filters you want in the report. The available // values can be found here: // https://developers.google.com/doubleclick-advertisers/reporting/v1.3/dimensions criteria.Dimensions = new List<SortedDimension> { new SortedDimension { Name = "dfa:floodlightConfigId" }, new SortedDimension { Name = "dfa:activity" }, new SortedDimension { Name = "dfa:advertiser" } }; criteria.MetricNames = new List<string> { "dfa:activityClickThroughConversions", "dfa:activityClickThroughRevenue", "dfa:activityViewThroughConversions", "dfa:activityViewThroughRevenue" }; criteria.DimensionFilters = new List<DimensionValue> { floodlightConfigId }; report.FloodlightCriteria = criteria; Report result = service.Reports.Insert(report, userProfileId).Execute(); Console.WriteLine("Created report with ID \"{0}\" and display name \"{1}\"", result.Id, result.Name); Console.WriteLine(); return result; }