Eyal Gershon
Eyal Gershon

Reputation: 11

Sending multiple item transaction for classic ecommerce via measurement protocol

I am trying to send a single transaction via measurement protocol for non enhanced ecommerce. For some reason I am not able to understand how I am to send a transaction with multiple items. Sifting through the Google Analytics measurement protocol documentation yielded no helpful information and I would like to know if someone has any experience in doing this.. For now I assume I would have to send a different request for each item, am I wrong?

Upvotes: 1

Views: 456

Answers (1)

Linda Lawton - DaImTo
Linda Lawton - DaImTo

Reputation: 116918

To send multiple hits in a single request, use the /batch endpoint instead of /collect and specify each payload on its own line.

For example, to send pageview hits for the "Home", "About Us", and "Contact" pages of a website, you could send the following batch request.

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

directly from the documentation Batching multiple hits in a single request

Upvotes: 0

Related Questions