/// <summary>
        /// Create a new custom dimension.
        /// Documentation https://developers.google.com/analytics/v3/reference/customDimensions/insert
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated analytics service.</param>
        /// <param name="accountId">Account ID for the custom dimension to create.</param>
        /// <param name="webPropertyId">Web property ID for the custom dimension to create.</param>
        /// <param name="body">A valid analytics v3 body.</param>
        /// <returns>CustomDimensionResponse</returns>
        public static CustomDimension Insert(analyticsService service, string accountId, string webPropertyId, CustomDimension body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (accountId == null)
                {
                    throw new ArgumentNullException(accountId);
                }
                if (webPropertyId == null)
                {
                    throw new ArgumentNullException(webPropertyId);
                }

                // Make the request.
                return(service.CustomDimensions.Insert(body, accountId, webPropertyId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request CustomDimensions.Insert failed.", ex);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get a custom metric to which the user has access.
        /// Documentation https://developers.google.com/analytics/v3/reference/customMetrics/get
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated analytics service.</param>
        /// <param name="accountId">Account ID for the custom metric to retrieve.</param>
        /// <param name="webPropertyId">Web property ID for the custom metric to retrieve.</param>
        /// <param name="customMetricId">The ID of the custom metric to retrieve.</param>
        /// <returns>CustomMetricResponse</returns>
        public static CustomMetric Get(analyticsService service, string accountId, string webPropertyId, string customMetricId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (accountId == null)
                {
                    throw new ArgumentNullException(accountId);
                }
                if (webPropertyId == null)
                {
                    throw new ArgumentNullException(webPropertyId);
                }
                if (customMetricId == null)
                {
                    throw new ArgumentNullException(customMetricId);
                }

                // Make the request.
                return(service.CustomMetrics.Get(accountId, webPropertyId, customMetricId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request CustomMetrics.Get failed.", ex);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Delete an experiment.
        /// Documentation https://developers.google.com/analytics/v3/reference/experiments/delete
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated analytics service.</param>
        /// <param name="accountId">Account ID to which the experiment belongs</param>
        /// <param name="webPropertyId">Web property ID to which the experiment belongs</param>
        /// <param name="profileId">View (Profile) ID to which the experiment belongs</param>
        /// <param name="experimentId">ID of the experiment to delete</param>
        public static void Delete(analyticsService service, string accountId, string webPropertyId, string profileId, string experimentId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (accountId == null)
                {
                    throw new ArgumentNullException(accountId);
                }
                if (webPropertyId == null)
                {
                    throw new ArgumentNullException(webPropertyId);
                }
                if (profileId == null)
                {
                    throw new ArgumentNullException(profileId);
                }
                if (experimentId == null)
                {
                    throw new ArgumentNullException(experimentId);
                }

                // Make the request.
                return(service.Experiments.Delete(accountId, webPropertyId, profileId, experimentId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Experiments.Delete failed.", ex);
            }
        }
        /// <summary>
        /// Create a new unsampled report.
        /// Documentation https://developers.google.com/analytics/v3/reference/unsampledReports/insert
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated analytics service.</param>
        /// <param name="accountId">Account ID to create the unsampled report for.</param>
        /// <param name="webPropertyId">Web property ID to create the unsampled report for.</param>
        /// <param name="profileId">View (Profile) ID to create the unsampled report for.</param>
        /// <param name="body">A valid analytics v3 body.</param>
        /// <returns>UnsampledReportResponse</returns>
        public static UnsampledReport Insert(analyticsService service, string accountId, string webPropertyId, string profileId, UnsampledReport body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (accountId == null)
                {
                    throw new ArgumentNullException(accountId);
                }
                if (webPropertyId == null)
                {
                    throw new ArgumentNullException(webPropertyId);
                }
                if (profileId == null)
                {
                    throw new ArgumentNullException(profileId);
                }

                // Make the request.
                return(service.UnsampledReports.Insert(body, accountId, webPropertyId, profileId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request UnsampledReports.Insert failed.", ex);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Gets a goal to which the user has access.
        /// Documentation https://developers.google.com/analytics/v3/reference/goals/get
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated analytics service.</param>
        /// <param name="accountId">Account ID to retrieve the goal for.</param>
        /// <param name="webPropertyId">Web property ID to retrieve the goal for.</param>
        /// <param name="profileId">View (Profile) ID to retrieve the goal for.</param>
        /// <param name="goalId">Goal ID to retrieve the goal for.</param>
        /// <returns>GoalResponse</returns>
        public static Goal Get(analyticsService service, string accountId, string webPropertyId, string profileId, string goalId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (accountId == null)
                {
                    throw new ArgumentNullException(accountId);
                }
                if (webPropertyId == null)
                {
                    throw new ArgumentNullException(webPropertyId);
                }
                if (profileId == null)
                {
                    throw new ArgumentNullException(profileId);
                }
                if (goalId == null)
                {
                    throw new ArgumentNullException(goalId);
                }

                // Make the request.
                return(service.Goals.Get(accountId, webPropertyId, profileId, goalId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Goals.Get failed.", ex);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Create a new property if the account has fewer than 20 properties. Web properties are visible in the Google Analytics interface only if they have at least one profile.
        /// Documentation https://developers.google.com/analytics/v3/reference/webproperties/insert
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated analytics service.</param>
        /// <param name="accountId">Account ID to create the web property for.</param>
        /// <param name="body">A valid analytics v3 body.</param>
        /// <returns>WebpropertyResponse</returns>
        public static Webproperty Insert(analyticsService service, string accountId, Webproperty body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (accountId == null)
                {
                    throw new ArgumentNullException(accountId);
                }

                // Make the request.
                return(service.Webproperties.Insert(body, accountId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Webproperties.Insert failed.", ex);
            }
        }
        /// <summary>
        /// Gets a remarketing audience to which the user has access.
        /// Documentation https://developers.google.com/analytics/v3/reference/remarketingAudience/get
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated analytics service.</param>
        /// <param name="accountId">The account ID of the remarketing audience to retrieve.</param>
        /// <param name="webPropertyId">The web property ID of the remarketing audience to retrieve.</param>
        /// <param name="remarketingAudienceId">The ID of the remarketing audience to retrieve.</param>
        /// <returns>RemarketingAudienceResponse</returns>
        public static RemarketingAudience Get(analyticsService service, string accountId, string webPropertyId, string remarketingAudienceId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (accountId == null)
                {
                    throw new ArgumentNullException(accountId);
                }
                if (webPropertyId == null)
                {
                    throw new ArgumentNullException(webPropertyId);
                }
                if (remarketingAudienceId == null)
                {
                    throw new ArgumentNullException(remarketingAudienceId);
                }

                // Make the request.
                return(service.RemarketingAudience.Get(accountId, webPropertyId, remarketingAudienceId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request RemarketingAudience.Get failed.", ex);
            }
        }
        /// <summary>
        /// Removes a user from the given account.
        /// Documentation https://developers.google.com/analytics/v3/reference/accountUserLinks/delete
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated analytics service.</param>
        /// <param name="accountId">Account ID to delete the user link for.</param>
        /// <param name="linkId">Link ID to delete the user link for.</param>
        public static void Delete(analyticsService service, string accountId, string linkId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (accountId == null)
                {
                    throw new ArgumentNullException(accountId);
                }
                if (linkId == null)
                {
                    throw new ArgumentNullException(linkId);
                }

                // Make the request.
                return(service.AccountUserLinks.Delete(accountId, linkId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request AccountUserLinks.Delete failed.", ex);
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// Returns a web property-AdWords link to which the user has access.
        /// Documentation https://developers.google.com/analytics/v3/reference/webPropertyAdWordsLinks/get
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated analytics service.</param>
        /// <param name="accountId">ID of the account which the given web property belongs to.</param>
        /// <param name="webPropertyId">Web property ID to retrieve the AdWords link for.</param>
        /// <param name="webPropertyAdWordsLinkId">Web property-AdWords link ID.</param>
        /// <returns>EntityAdWordsLinkResponse</returns>
        public static EntityAdWordsLink Get(analyticsService service, string accountId, string webPropertyId, string webPropertyAdWordsLinkId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (accountId == null)
                {
                    throw new ArgumentNullException(accountId);
                }
                if (webPropertyId == null)
                {
                    throw new ArgumentNullException(webPropertyId);
                }
                if (webPropertyAdWordsLinkId == null)
                {
                    throw new ArgumentNullException(webPropertyAdWordsLinkId);
                }

                // Make the request.
                return(service.WebPropertyAdWordsLinks.Get(accountId, webPropertyId, webPropertyAdWordsLinkId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request WebPropertyAdWordsLinks.Get failed.", ex);
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// Returns a filters to which the user has access.
        /// Documentation https://developers.google.com/analytics/v3/reference/filters/get
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated analytics service.</param>
        /// <param name="accountId">Account ID to retrieve filters for.</param>
        /// <param name="filterId">Filter ID to retrieve filters for.</param>
        /// <returns>FilterResponse</returns>
        public static Filter Get(analyticsService service, string accountId, string filterId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (accountId == null)
                {
                    throw new ArgumentNullException(accountId);
                }
                if (filterId == null)
                {
                    throw new ArgumentNullException(filterId);
                }

                // Make the request.
                return(service.Filters.Get(accountId, filterId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Filters.Get failed.", ex);
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// Delete data associated with a previous upload.
        /// Documentation https://developers.google.com/analytics/v3/reference/uploads/deleteUploadData
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated analytics service.</param>
        /// <param name="accountId">Account Id for the uploads to be deleted.</param>
        /// <param name="webPropertyId">Web property Id for the uploads to be deleted.</param>
        /// <param name="customDataSourceId">Custom data source Id for the uploads to be deleted.</param>
        /// <param name="body">A valid analytics v3 body.</param>
        public static void DeleteUploadData(analyticsService service, string accountId, string webPropertyId, string customDataSourceId, AnalyticsDataimportDeleteUploadDataRequest body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (accountId == null)
                {
                    throw new ArgumentNullException(accountId);
                }
                if (webPropertyId == null)
                {
                    throw new ArgumentNullException(webPropertyId);
                }
                if (customDataSourceId == null)
                {
                    throw new ArgumentNullException(customDataSourceId);
                }

                // Make the request.
                return(service.Uploads.DeleteUploadData(body, accountId, webPropertyId, customDataSourceId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Uploads.DeleteUploadData failed.", ex);
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// Creates an account ticket.
        /// Documentation https://developers.google.com/analytics/v3/reference/provisioning/createAccountTicket
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated analytics service.</param>
        /// <param name="body">A valid analytics v3 body.</param>
        /// <returns>AccountTicketResponse</returns>
        public static AccountTicket CreateAccountTicket(analyticsService service, AccountTicket body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }

                // Make the request.
                return(service.Provisioning.CreateAccountTicket(body).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Provisioning.CreateAccountTicket failed.", ex);
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// Lists all columns for a report type
        /// Documentation https://developers.google.com/analytics/v3/reference/columns/list
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated analytics service.</param>
        /// <param name="reportType">Report type. Allowed Values: 'ga'. Where 'ga' corresponds to the Core Reporting API</param>
        /// <returns>ColumnsResponse</returns>
        public static Columns List(analyticsService service, string reportType)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (reportType == null)
                {
                    throw new ArgumentNullException(reportType);
                }

                // Make the request.
                return(service.Columns.List(reportType).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Columns.List failed.", ex);
            }
        }