승인 필요
기존 실험을 업데이트합니다. 이 메서드는 패치 시맨틱스를 지원합니다. 예를 참조하세요.
이 방법은 표준 매개변수 외에도 매개변수 표에 나열된 매개변수를 지원합니다.
요청
HTTP 요청
PATCH https://www.googleapis.com/analytics/v3/management/accounts/accountId/webproperties/webPropertyId/profiles/profileId/experiments/experimentId
매개변수
매개변수 이름 | 값 | 설명 |
---|---|---|
경로 매개변수 | ||
accountId |
string |
업데이트할 실험의 계정 ID입니다. |
experimentId |
string |
업데이트할 실험의 실험 ID입니다. |
profileId |
string |
업데이트할 실험의 보기 (프로필) ID입니다. |
webPropertyId |
string |
업데이트할 실험의 웹 속성 ID입니다. |
승인
이 요청에는 다음 범위 중 최소 하나를 사용하여 인증이 필요합니다. (인증 및 승인에 대해 자세히 알아보기)
범위 |
---|
https://www.googleapis.com/auth/analytics |
https://www.googleapis.com/auth/analytics.edit |
요청 본문
요청 본문에 패치 의미 체계 규칙에 따라 management.experiment 리소스의 관련 부분에 다음 속성을 제공합니다.
속성 이름 | 값 | 설명 | Notes |
---|---|---|---|
필수 속성 | |||
id |
string |
실험 ID입니다. 패치 및 업데이트에 필요합니다. 생성이 허용되지 않습니다. | |
선택 속성 | |||
description |
string |
이 실험에 대한 참고사항입니다. | 쓰기 가능 |
editableInGaUi |
boolean |
true인 경우 최종 사용자가 Google 애널리틱스 사용자 인터페이스를 통해 실험을 수정할 수 있습니다. | 쓰기 가능 |
equalWeighting |
boolean |
모든 변형에 트래픽을 균등하게 분산할지 여부를 지정하는 부울입니다. 값이 False인 경우 콘텐츠 실험은 대안 실적에 따라 트래픽을 동적으로 조정하는 기본 동작을 따릅니다. 선택사항 -- 기본값은 False입니다. 상태가 종료인 실험의 경우 이 필드를 변경할 수 없습니다. | 쓰기 가능 |
minimumExperimentLengthInDays |
integer |
[3, 90]의 정수입니다. 실험의 최소 길이를 지정합니다. 실행 중인 실험에서 변경할 수 있습니다. 상태가 종료인 실험의 경우 이 필드를 변경할 수 없습니다. | 쓰기 가능 |
name |
string |
실험명입니다. 상태가 종료인 실험의 경우 이 필드를 변경할 수 없습니다. 실험을 만들 때 이 필드가 필요합니다. | 쓰기 가능 |
objectiveMetric |
string |
실험에서 최적화하는 측정항목입니다. 유효한 값은 'ga:goal(n)COMPLETEs', 'ga:adsenseAdsClicks', 'ga:adsenseAdsViewed', 'ga:adsenseRevenue', 'ga:bounces", "ga:pageviews", "ga:sessionDuration", "ga:transactions", "ga:transactionRevenue"입니다. 상태가 'RUNNING'이고 ServingFramework가 'REDIRECT' 또는 'API' 중 하나인 경우 이 필드가 필요합니다. | 쓰기 가능 |
optimizationType |
string |
objectMetric을 최소화하거나 최대화해야 하는지 여부입니다. 가능한 값은 'MAXIMUM', 'MINIMUM'입니다. 선택사항--기본값은 'MAXIMUM'입니다. objectMetric 없이는 지정할 수 없습니다. 상태가 '실행 중' 또는 '종료'인 경우 수정할 수 없습니다. | 쓰기 가능 |
rewriteVariationUrlsAsOriginal |
boolean |
대안 URL을 원본 URL과 일치하도록 재작성할지 여부를 지정하는 부울입니다. 상태가 종료인 실험의 경우 이 필드를 변경할 수 없습니다. | 쓰기 가능 |
servingFramework |
string |
실험 대안을 게재하고 결과를 평가하는 데 사용되는 프레임워크입니다. 다음 중 하나:
|
쓰기 가능 |
status |
string |
실험 상태입니다. 가능한 값은 'DRAFT', 'READY_TO_RUN', 'RUNNING', 'ENDED'입니다. 실험은 'DRAFT', 'READY_TO_RUN' 또는 'RUNNING' 상태로 만들 수 있습니다. 실험을 만들 때 이 필드가 필요합니다. | 쓰기 가능 |
trafficCoverage |
double |
0과 1 사이의 부동 소수점 수입니다. 실험에 참여하는 트래픽의 비율을 지정합니다. 실행 중인 실험에서 변경할 수 있습니다. 상태가 종료인 실험의 경우 이 필드를 변경할 수 없습니다. | 쓰기 가능 |
variations[] |
list |
변형의 배열입니다. 배열의 첫 번째 대안 페이지는 원본입니다. 실험이 실행 중 상태이면 대안 페이지 수가 변경되지 않습니다. 상태를 RUNNING으로 설정하려면 변형이 2개 이상 필요합니다. | 쓰기 가능 |
variations[].name |
string |
유사 광고의 이름입니다. 실험을 만들 때 이 필드가 필요합니다. 상태가 종료인 실험의 경우 이 필드를 변경할 수 없습니다. | 쓰기 가능 |
variations[].status |
string |
유사 광고의 상태입니다. 가능한 값은 'ACTIVE', 'INACTIVE'입니다. INACTIVE 상태의 대안 페이지는 게재되지 않습니다. 상태가 종료인 실험의 경우 이 필드를 변경할 수 없습니다. | 쓰기 가능 |
variations[].url |
string |
유사 광고의 URL입니다. 상태가 '실행 중' 또는 '종료됨'인 실험의 경우 이 필드를 변경할 수 없습니다. | 쓰기 가능 |
winnerConfidenceLevel |
double |
0과 1 사이의 부동 소수점 수입니다. 실적이 가장 우수한 설정을 선택하는 데 필요한 신뢰도 수준을 지정합니다. 상태가 종료인 실험의 경우 이 필드를 변경할 수 없습니다. | 쓰기 가능 |
응답
요청에 성공할 경우 이 메서드는 응답 본문에 management.experiment 리소스를 반환합니다.
예
참고: 이 메서드에 제공되는 코드 예시가 지원되는 모든 프로그래밍 언어를 나타내는 것은 아닙니다. 지원되는 언어 목록은 클라이언트 라이브러리 페이지를 참조하세요.
Java
자바 클라이언트 라이브러리를 사용합니다.
/* * Note: This code assumes you have an authorized Analytics service object. * See the Experiments Developer Guide for details. */ // This example patches an existing experiment with new variations. Variations variationA = new Variations(); variationA.setName("Home A"); variationA.setUrl("homeA.html"); Variations variationB = new Variations(); variationB.setName("Home B"); variationB.setUrl("homeB.html"); List<Variations> variations = Arrays.asList(variationA, variationB); try { // First get an existing Experiment. Experiment body = analytics.management().experiments().get("123456", "UA-123456-1", "7654321", "122333444455555").execute(); // Set the new variations. body.setVariations(variations); // Call Patch with the updated experiment. analytics.management().experiments().patch("123456", "UA-123456-1", "7654321", "12233344455555", body).execute(); } catch (GoogleJsonResponseException e) { System.err.println("There was a service error: " + e.getDetails().getCode() + " : " + e.getDetails().getMessage()); }
2,399필리핀
PHP 클라이언트 라이브러리를 사용합니다.
/** * Note: This code assumes you have an authorized Analytics service object. * See the Experiments Developer Guide for details. */ /** * This request patches an existing experiment. */ // Construct the first variation. $variationA = new Google_Service_Analytics_ExperimentVariations(); $variationA->setName('VariationA'); $variationA->setUrl('index.html'); // Construct the second variation. $variationB = new Google_Service_Analytics_ExperimentVariations(); $variationB->setName('VariationB'); $variationB->setUrl('indexB.html'); try { // Get an existing Experiment. $experiment = $analytics->management_experiments->get('123456', 'UA-123456-1', '7654321', '122333444455555'); // Set the new variations. $experiment->setVariations(array($variationA, $variationB)); // Call the patch method with the updated experiment. $analytics->management_experiments->patch('123456', 'UA-123456-1', '7654321', '122333444455555', $experiment); } catch (apiServiceException $e) { print 'There was an Analytics API service error ' . $e->getCode() . ':' . $e->getMessage(); } catch (apiException $e) { print 'There was a general API error ' . $e->getCode() . ':' . $e->getMessage(); }
Python
Python 클라이언트 라이브러리를 사용합니다.
# Note: This code assumes you have an authorized Analytics service object. # See the Experiments Developer Guide for details. # This request patches an existing experiment with a new name, # and new variations. try: analytics.management().experiments().patch( accountId='123456', webPropertyId='UA-123456-1', profileId='7654321', experimentId='ABCDEFG123456abcdefg', body={ 'name': 'Landing Page Test April', 'variations': [ { 'name': 'First Variation', 'url': 'index.html' }, { 'name': 'Proposed Change', 'url': 'indexB.html' } ] } ).execute() except TypeError, error: # Handle errors in constructing a query. print 'There was an error in constructing your query : %s' % error except HttpError, error: # Handle API errors. print ('There was an API error : %s : %s' % (error.resp.status, error.resp.reason))
JavaScript
/* * Note: This code assumes you have an authorized Analytics client object. * See the Experiments Developer Guide for details. */ /* * This request patches an existing experiment. */ function patchExperiment() { var request = gapi.client.analytics.management.experiments.patch( { 'accountId': '123456', 'webPropertyId': 'UA-123456-1', 'profileId': '7654321', 'experimentId': '122333444455555', 'resource': { 'name': 'Landing Page Test', 'status': 'DRAFT', 'variations': [ { 'name': 'VariationA', 'url': 'index.html' }, { 'name': 'VariationB', 'url': 'indexB.html' } ] } }); request.execute(function (response) { // Handle the response. }); }