/// <summary> /// Update an existing web property. This method supports patch semantics /// Documentation:https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtReference/management/webproperties/patch /// /// Beta Access: https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtWebpropertyGuide#code /// Write operations in the Management API (e.g. create, update, delete, patch) for Web Property, View (Profile), /// and Goal resources is currently available as a developer preview in limited beta. If you're interested in using these features, /// request access to the beta. /// https://docs.google.com/forms/d/1xyjp6ca4YkGjh7TDi1Z3XyA3XHcRHkKzFentxzUrmPY/viewform /// /// /// </summary> /// <param name="service">Valid Authenticated Analytics Service </param> /// <param name="Body">relevant portions of a management.webproperty resource, according to the rules of patch semantics.</param> /// <param name="accountId">Account ID to which the web property belongs </param> /// <param name="webPropertyId">Web property ID</param> /// <returns>A Web property resource https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtReference/management/webproperties </returns> public static Webproperty WebpropertyUpdate(AnalyticsService service, Webproperty body, string accountId, string webPropertyId) { try { Webproperty wp = service.Management.Webproperties.Update(body, accountId, webPropertyId).Execute(); return wp; } catch (Exception ex) { Console.WriteLine(ex.Message); return null; } }
/// <summary> /// Create a new property if the account has fewer than 20 properties. /// Documentation: https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtReference/management/webproperties/insert /// /// Beta Access: https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtWebpropertyGuide#code /// Write operations in the Management API (e.g. create, update, delete, patch) for Web Property, View (Profile), /// and Goal resources is currently available as a developer preview in limited beta. If you're interested in using these features, /// request access to the beta. /// https://docs.google.com/forms/d/1xyjp6ca4YkGjh7TDi1Z3XyA3XHcRHkKzFentxzUrmPY/viewform /// /// /// </summary> /// <param name="service">Valid Authenticated Analytics Service </param> /// <param name="accountId">Account Id </param> /// <param name="name">Name of the new webProperty</param> /// <param name="websiteURL">URL for the website of the new webProperty</param> /// <returns>A Web property resource https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtReference/management/webproperties </returns> public static Webproperty WebpropertyInsert(AnalyticsService service, string accountId, string name, string websiteURL) { Webproperty body = new Webproperty(); body.WebsiteUrl = websiteURL; body.Name = name; try { Webproperty wp = service.Management.Webproperties.Insert(body, accountId).Execute(); return wp; } catch (Exception ex) { Console.WriteLine(ex.Message); return null; } }