이 문서에서는 일반적인 조회수를 측정 프로토콜로 전송하는 방법을 설명합니다.
개요
이 문서에서는 일반적인 조회 유형을 Google 애널리틱스 측정 프로토콜로 전송하도록 HTTP 요청의 형식을 지정하는 방법을 보여줍니다. 다음을 읽어보세요.
필수 값 전송
사용자 상호작용 데이터를 전송하려면 이 엔드포인트에 HTTP POST 요청을 수행합니다.
POST /collect HTTP/1.1 Host: www.google-analytics.com payload_data
각 페이로드에는 다음 매개변수가 필요합니다.
v=1 // Version. &tid=UA-XXXXX-Y // Tracking ID / Property ID. &cid=555 // Anonymous Client ID. &t= // Hit Type.
각 페이로드에는 유효한 조회 유형이 포함되어야 하며 각 조회 유형에는 자체 필수 필드 조합이 있습니다. 따라서 /home
페이지의 페이지 조회수를 보내려면 다음 페이로드를 사용합니다.
v=1&tid=UA-XXXXX-Y&cid=555&t=pageview&dp=%2Fhome
아래 섹션에서는 일반적인 조회 유형의 예를 보여줍니다.
단일 요청에 여러 조회 일괄 처리
단일 요청으로 여러 조회를 전송하려면 /collect
대신 /batch
엔드포인트를 사용하고 각 페이로드를 한 줄에 지정합니다.
예를 들어 웹사이트의 '홈', '회사 소개', '연락처' 페이지의 페이지 조회를 전송하려면 다음 일괄 요청을 전송할 수 있습니다.
POST /batch HTTP/1.1 Host: www.google-analytics.com v=1&tid=UA-XXXXX-Y&cid=555&t=pageview&dp=%2Fhome v=1&tid=UA-XXXXX-Y&cid=555&t=pageview&dp=%2Fabout v=1&tid=UA-XXXXX-Y&cid=555&t=pageview&dp=%2Fcontact
일괄 제한사항
일괄 처리 프로토콜 조회의 표준 제한사항 외에도 일괄 요청에는 다음과 같은 추가 제한사항이 있습니다.
- 요청당 최대 20회의 조회를 지정할 수 있습니다.
- 모든 조회 페이로드의 총 크기는 16,000바이트를 초과할 수 없습니다.
- 단일 조회 페이로드는 8K를 초과할 수 없습니다.
일반적인 조회 유형 전송
다음은 일반적인 조회 유형을 Google 애널리틱스로 전송하는 방법의 예입니다.
이러한 예 외에도 다양한 매개변수를 조합하여 새로운 데이터 관계를 얻을 수 있습니다. 예를 들어 이벤트가 발생한 페이지를 알아보려면 아래에 설명된 대로 pagePath 매개변수 p
를 이벤트 추적 매개변수와 함께 전송하세요.
Google 애널리틱스로 전송할 수 있는 모든 매개변수의 전체 목록은 매개변수 참조를 확인하세요.
페이지 추적
v=1 // Version. &tid=UA-XXXXX-Y // Tracking ID / Property ID. &cid=555 // Anonymous Client ID. &t=pageview // Pageview hit type. &dh=mydemo.com // Document hostname. &dp=/home // Page. &dt=homepage // Title.
이 조회는 측정 프로토콜 조회 빌더에서 확인하세요.
이벤트 추적
v=1 // Version. &tid=UA-XXXXX-Y // Tracking ID / Property ID. &cid=555 // Anonymous Client ID. &t=event // Event hit type &ec=video // Event Category. Required. &ea=play // Event Action. Required. &el=holiday // Event label. &ev=300 // Event value.
이 조회는 측정 프로토콜 조회 빌더에서 확인하세요.
향상된 전자상거래 추적
전자상거래 조회 대신 향상된 전자상거래 조회를 사용해야 합니다. 전자상거래 추적을 이미 구현한 상태에서 향상된 전자상거래 추적을 사용하려는 경우 두 가지 방법이 있습니다.
새 속성 사용
새 속성을 만들고 향상된 전자상거래 조회를 새 속성으로 보낼 수 있습니다.
기존 속성 이전
아래 예를 따라 전자상거래 조회를 향상된 전자상거래 조회로 이전합니다. 이전에 전자상거래 조회를 사용하여 수집된 거래 및 항목 데이터는 영향을 받지 않으며 원래 전송된 속성 및 보기에서 계속 사용할 수 있습니다.
노출수 측정
v=1 // Version. &tid=UA-XXXXX-Y // Tracking ID / Property ID. &cid=555 // Anonymous Client ID. &t=pageview // Pageview hit type. &dh=mydemo.com // Document hostname. &dp=/home // Page. &dt=homepage // Title. &il1nm=Search%20Results // Impression list 1. Required. &il1pi1id=P12345 // Product Impression 1 ID. Either ID or name must be set. &il1pi1nm=Android%20Warhol%20T-Shirt // Product Impression 1 name. Either ID or name must be set. &il1pi1ca=Apparel%2FT-Shirts // Product Impression 1 category. &il1pi1br=Google // Product Impression 1 brand. &il1pi1va=Black // Product Impression 1 variant. &il1pi1ps=1 // Product Impression 1 position. &il1pi1cd1=Member // Custom dimension. &il2nm=Recommended%20Products // Impression list 2. &il2pi1nm=Yellow%20T-Shirt // Product Impression 1 name. &il2pi2nm=Red%20T-Shirt // Product Impression 2 name.
이 조회는 측정 프로토콜 조회 빌더에서 확인하세요.
작업 측정
v=1 // Version. &tid=UA-XXXXX-Y // Tracking ID / Property ID. &cid=555 // Anonymous Client ID. &t=event // Event hit type. &ec=UX // Event Category. Required. &ea=click // Event Action. Required. &el=Results // Event label. &pa=click // Product action (click). Required. &pal=Search%20Results // Product Action List. &pr1id=P12345 // Product 1 ID. Either ID or name must be set. &pr1nm=Android%20Warhol%20T-Shirt // Product 1 name. Either ID or name must be set. &pr1ca=Apparel // Product 1 category. &pr1br=Google // Product 1 brand. &pr1va=Black // Product 1 variant. &pr1ps=1 // Product 1 position.
이 조회는 측정 프로토콜 조회 빌더에서 확인하세요.
노출수와 작업 결합
v=1 // Version. &tid=UA-XXXXX-Y // Tracking ID / Property ID. &cid=555 // Anonymous Client ID. &t=event // Event hit type. &ec=UX // Event Category. Required. &ea=click // Event Action. Required. &el=Results // Event label. &pa=detail // Product action (detail). Required. &pr1id=P12345 // Product 1 ID. Either ID or name must be set. &pr1nm=Android%20Warhol%20T-Shirt // Product 1 name. Either ID or name must be set. &pr1ca=Apparel // Product 1 category. &pr1br=Google // Product 1 brand. &pr1va=Black // Product 1 variant. &pr1ps=1 // Product 1 position. &il1nm=Related%20Products // Impression list. &il1pi1id=P12345 // Product Impression 1 ID. &il1pi1nm=Android%20Warhol%20T-Shirt // Product Impression 1 name. &il1pi1ca=Apparel%2FT-Shirts // Product Impression 1 category. &il1pi1br=Google // Product Impression 1 brand. &il1pi1va=Black // Product Impression 1 variant. &il1pi1ps=1 // Product Impression 1 position.
이 조회는 측정 프로토콜 조회 빌더에서 확인하세요.
구매 측정
v=1 // Version. &tid=UA-XXXXX-Y // Tracking ID / Property ID. &cid=555 // Anonymous Client ID. &t=pageview // Pageview hit type. &dh=mydemo.com // Document hostname. &dp=/receipt // Page. &dt=Receipt%20Page // Title. &ti=T12345 // Transaction ID. Required. &ta=Google%20Store%20-%20Online // Affiliation. &tr=37.39 // Revenue. &tt=2.85 // Tax. &ts=5.34 // Shipping. &tcc=SUMMER2013 // Transaction coupon. &pa=purchase // Product action (purchase). Required. &pr1id=P12345 // Product 1 ID. Either ID or name must be set. &pr1nm=Android%20Warhol%20T-Shirt // Product 1 name. Either ID or name must be set. &pr1ca=Apparel // Product 1 category. &pr1br=Google // Product 1 brand. &pr1va=Black // Product 1 variant. &pr1ps=1 // Product 1 position.
이 조회는 측정 프로토콜 조회 빌더에서 확인하세요.
환불 측정
이벤트를 사용하여 환불 데이터를 보내야 하는데 이벤트가 일반적으로 측정되는 현장 동작에 포함되어 있지 않은 경우 (예: 사용자가 시작하지 않음) 비상호작용 이벤트를 전송하는 것이 좋습니다. 이렇게 하면 이탈률, 세션 시간 등의 측정항목이 이벤트의 영향을 받지 않습니다.
// Refund an entire transaction and send with a non-interaction event. v=1 // Version. &tid=UA-XXXXX-Y // Tracking ID / Property ID. &cid=555 // Anonymous Client ID. &t=event // Event hit type. &ec=Ecommerce // Event Category. Required. &ea=Refund // Event Action. Required. &ni=1 // Non-interaction parameter. &ti=T12345 // Transaction ID. Required. &pa=refund // Product action (refund). Required.
이 조회는 측정 프로토콜 조회 빌더에서 확인하세요.
// Refund a single product. v=1 // Version. &tid=UA-XXXXX-Y // Tracking ID / Property ID. &cid=555 // Anonymous Client ID. &t=event // Event hit type. &ec=Ecommerce // Event Category. Required. &ea=Refund // Event Action. Required. &ni=1 // Non-interaction parameter. &ti=T12345 // Transaction ID. Required. &pa=refund // Product action (refund). Required. &pr1id=P12345 // Product 1 ID. Required. &pr1qt=1 // Product 1 quantity. Required.
이 조회는 측정 프로토콜 조회 빌더에서 확인하세요.
결제 절차 측정
1. 결제 단계 측정
v=1 // Version. &tid=UA-XXXXX-Y // Tracking ID / Property ID. &cid=555 // Anonymous Client ID. &t=pageview // Pageview hit type. &dh=mydemo.com // Document hostname. &dp=/checkout // Page. &dt=Checkout // Title. &pa=checkout // Product action (checkout). &pr1id=P12345 // Product 1 ID. Either ID or name must be set. &pr1nm=Android%20Warhol%20T-Shirt // Product 1 name. Either ID or name must be set. &pr1ca=Apparel // Product 1 category. &pr1br=Google // Product 1 brand. &pr1va=Black // Product 1 variant. &pr1pr=29.20 // Product 1 Price. &pr1qt=1 // Product 1 quantity. &cos=1 // Checkout step #1. &col=Visa // Checkout step option.
이 조회는 측정 프로토콜 조회 빌더에서 확인하세요.
2. 결제 옵션 측정
v=1 // Version. &tid=UA-XXXXX-Y // Tracking ID / Property ID. &cid=555 // Anonymous Client ID. &t=event // Event hit type &ec=Checkout // Event Category. Required. &ea=Option // Event Action. Required. &pa=checkout_option // Product action (checkout_option). &cos=2 // Checkout step. &col=FedEx // Checkout step option.
이 조회는 측정 프로토콜 조회 빌더에서 확인하세요.
내부 프로모션 측정
프로모션 노출수
v=1 // Version. &tid=UA-XXXXX-Y // Tracking ID / Property ID. &cid=555 // Anonymous Client ID. &t=pageview // Pageview hit type. &dh=mydemo.com // Document hostname. &dp=/home // Page. &dt=homepage // Title. &promo1id=PROMO_1234 // Promotion 1 ID. Either ID or name must be set. &promo1nm=Summer%20Sale // Promotion 1 name. Either ID or name must be set. &promo1cr=summer_banner2 // Promotion Creative. &promo1ps=banner_slot1 // Promotion Position.
이 조회는 측정 프로토콜 조회 빌더에서 확인하세요.
프로모션 클릭수
v=1 // Version. &tid=UA-XXXXX-Y // Tracking ID / Property ID. &cid=555 // Anonymous Client ID. &t=event // Event hit type &ec=Internal%20Promotions // Event Category. Required. &ea=click // Event Action. Required. &el=Summer%20Sale // Event label. &promoa=click // Promotion action (click). Required. &promo1id=PROMO_1234 // Promotion 1 ID. Either ID or name must be set. &promo1nm=Summer%20Sale // Promotion 1 name. Either ID or name must be set. &promo1cr=summer_banner2 // Promotion Creative. &promo1ps=banner_slot1 // Promotion Position.
이 조회는 측정 프로토콜 조회 빌더에서 확인하세요.
전자상거래 추적
전자상거래 데이터를 전송하려면 transaction
거래를 1회 전송하여 전체 거래를
표시한 다음 거래의 각 상품에 item
조회를 전송합니다. 거래 ID ti
는 전체 구매를 나타내기 위해 모든 조회를 연결합니다.
거래 조회수
v=1 // Version. &tid=UA-XXXXX-Y // Tracking ID / Property ID. &cid=555 // Anonymous Client ID. &t=transaction // Transaction hit type. &ti=12345 // transaction ID. Required. &ta=westernWear // Transaction affiliation. &tr=50.00 // Transaction revenue. &ts=32.00 // Transaction shipping. &tt=12.00 // Transaction tax. &cu=EUR // Currency code.
이 조회는 측정 프로토콜 조회 빌더에서 확인하세요.
항목 조회수
v=1 // Version. &tid=UA-XXXXX-Y // Tracking ID / Property ID. &cid=555 // Anonymous Client ID. &t=item // Item hit type. &ti=12345 // Transaction ID. Required. &in=sofa // Item name. Required. &ip=300 // Item price. &iq=2 // Item quantity. &ic=u3eqds43 // Item code / SKU. &iv=furniture // Item variation / category. &cu=EUR // Currency code.
이 조회는 측정 프로토콜 조회 빌더에서 확인하세요.
소셜 상호작용
v=1 // Version. &tid=UA-XXXXX-Y // Tracking ID / Property ID. &cid=555 // Anonymous Client ID. &t=social // Social hit type. &sa=like // Social Action. Required. &sn=facebook // Social Network. Required. &st=/home // Social Target. Required.
이 조회는 측정 프로토콜 조회 빌더에서 확인하세요.
예외 추적
v=1 // Version. &tid=UA-XXXXX-Y // Tracking ID / Property ID. &cid=555 // Anonymous Client ID. &t=exception // Exception hit type. &exd=IOException // Exception description. &exf=1 // Exception is fatal?
이 조회는 측정 프로토콜 조회 빌더에서 확인하세요.
사용자 시간 추적
v=1 // Version. &tid=UA-XXXXX-Y // Tracking ID / Property ID. &cid=555 // Anonymous Client ID. &t=timing // Timing hit type. &utc=jsonLoader // Timing category. &utv=load // Timing variable. &utt=5000 // Timing time. &utl=jQuery // Timing label. // These values are part of browser load times &dns=100 // DNS load time. &pdt=20 // Page download time. &rrt=32 // Redirect time. &tcp=56 // TCP connect time. &srt=12 // Server response time.
이 조회는 측정 프로토콜 조회 빌더에서 확인하세요.
앱 / 화면 추적
v=1 // Version. &tid=UA-XXXXX-Y // Tracking ID / Property ID. &cid=555 // Anonymous Client ID. &t=screenview // Screenview hit type. &an=funTimes // App name. &av=1.5.0 // App version. &aid=com.foo.App // App Id. &aiid=com.android.vending // App Installer Id. &cd=Home // Screen name / content description.
이 조회는 측정 프로토콜 조회 빌더에서 확인하세요.
프록시 서버 사용
일부 환경은 조회를 Google 애널리틱스로 직접 전송할 수 없습니다. 예를 들어 방화벽으로 보호되는 자바스크립트나 기업 인트라넷을 실행할 수 없는 구형 휴대전화가 이에 해당합니다. 이러한 경우 프록시 서버로 요청을 보낸 다음, 측정 프로토콜을 사용하여 조회를 Google 애널리틱스로 전달하는 것이 일반적입니다.
프록시 서버가 아닌 클라이언트 기기에서 IP와 사용자 에이전트를 수집하려면 측정 프로토콜에 두 값을 지정하면 됩니다. 그러면 Google 애널리틱스에서 일반적으로 요청 헤더에서 가져오는 값이 재정의됩니다.
v=1 // Version. &tid=UA-XXXXX-Y // Tracking ID / Property ID. &cid=555 // Anonymous Client ID. &t=pageview // Pageview hit type. &uip=1.2.3.4 // IP address override. &ua=Opera/9.80 // User agent override.
이 조회는 측정 프로토콜 조회 빌더에서 확인하세요.