I got the confirmation Email regarding project whitelisting from Google Analytics team and tried inserting a Goal but got the error.
{The service analytics has thrown an exception: Google.GoogleApiException: Google.Apis.Requests.RequestError
Your project does not have access to this feature. [403]
Errors [
Message[Your project does not have access to this feature.] Location[ - ] Reason[insufficientPermissions] Domain[global]
]
at Google.Apis.Requests.ClientServiceRequest`1.<ParseResponse>d__34.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Google.Apis.Requests.ClientServiceRequest`1.Execute()}
I'm using the Google.Apis.Analytics.v3 (1.32) nuget package for creating the goal
The code I've written is:
var goal = new Goal();
goal.AccountId = accId;
goal.WebPropertyId = websiteId;
goal.ProfileId = profileId;
goal.Name = "Api Funnel";
goal.Active = true;
goal.Created = new DateTime();
goal.Type = "URL_DESTINATION";
var urlDestinationDetails = new UrlDestinationDetailsData();
urlDestinationDetails.MatchType = "EXACT";
var stepData0 = new UrlDestinationDetailsData.StepsData();
stepData0.Number = 0;
stepData0.Url = "step1";
stepData0.Name = "Step1";
var stepData1 = new UrlDestinationDetailsData.StepsData();
stepData1.Number = 0;
stepData1.Url = "step2";
stepData1.Name = "Step2";
var steps = new List<UrlDestinationDetailsData.StepsData>();
urlDestinationDetails.Steps = steps;
goal.UrlDestinationDetails = urlDestinationDetails;
goal.UrlDestinationDetails.Url = "step2";
var request = analyticsService.Management.Goals.Insert(goal, accId, websiteId, profileId);
request.Execute();
Scope is set to analytics.edit :
Still, I'm facing the issue
google analytics management api - Insert goals - 403
Also referred to the respective post but couldn't find any answer.
All the get requests were processed successfully returning the correct data. Now, I want to insert a goal but having this issue.
Also asked using the issue tracker of google
https://issuetracker.google.com/issues/71837169
Also the developer forum group is closed now : https://groups.google.com/forum/?fromgroups#!forum/google-analytics-management-api
Please feel free to ask any additional information.