Search code examples
google-analyticsmeasurement-protocol

Google Analytics Measurement Protocol Measuring Transaction but not Product Data


Given the payload:

v=1
&tid=UA-REDACTED
&ds=web
&cid=REDACTED
&uid=15844
&uip=REDACTED
&ua=Mozilla%2f5.0+(Windows+NT+10.0%3b+Win64%3b+x64)+AppleWebKit%2f537.36+(KHTML%2c+like+Gecko)+Chrome%2f68.0.3440.106+Safari%2f537.36
&ul=en-gb
&dp=%2f
&dh=www.devserver.com
&t=transaction
&ti=TestTxn8TI
&tr=105
&tt=10
&ts=5
&cu=EUR
&ds=web
&pr1id=testsku
&pr1nm=test%20product%20description
&pr1ca=hardware
&pr1pr=100
&pr1qt=1
&pr2id=testsku2
&pr2nm=another%20description
&pr2ca=hardware
&pr2pr=20
&pr2qt=2
&pa=purchase

It's correctly measuring the transaction:

enter image description here

However no associated product data. How do I get the product data to show?


Solution

  • Seems to me that you're mixing Ecommerce hits, with Enhanced Ecommerce hit.

    According to Measurement Protocol documentation for Enhanced Ecommerce Tracking:

    Important: Enhanced Ecommerce parameters must be sent with an existing hit (e.g. pageview, event), but cannot be sent with the Ecommerce transaction or item hit types.

    With that being said, to continue sending the hit under Ecommerce Tracking:

    1. Trigger a Transaction Hit

      v=1
      &tid=UA-XXXXX-Y
      &cid=555
      &t=transaction
      &ti=TestTxn8TI
      &tr=105
      &ts=5
      &tt=10
      &cu=EUR
      
    2. Trigger Item Hit for each product in the transaction

      v=1
      &tid=UA-XXXXX-Y
      &cid=555
      &t=item
      &ti=testsku
      &in=test%20product%20description
      &ip=100
      &iq=1
      &iv=hardware
      &cu=EUR
      
      v=1
      &tid=UA-XXXXX-Y
      &cid=555
      &t=item
      &ti=testsku2
      &in=another%20description
      &ip=20
      &iq=2
      &iv=hardware
      &cu=EUR
      

    If you're interested in sending the hit under Enhanced Ecommerce Tracking, simply change the Hit Type from transaction to pageview, like:

        v=1
        &tid=UA-XXXXX-Y
        &cid=555
        &t=pageview
        &dh=www.devserver.com
        &dp=%2f
        &ds=web
        &uid=15844
        &uip=REDACTED
        &ua=Mozilla%2f5.0+(Windows+NT+10.0%3b+Win64%3b+x64)+AppleWebKit%2f537.36+(KHTML%2c+like+Gecko)+Chrome%2f68.0.3440.106+Safari%2f537.36
        &ul=en-gb
        &ti=TestTxn8TI
        &tr=105
        &tt=10
        &ts=5
        &cu=EUR
        &pa=purchase
        &pr1id=testsku
        &pr1nm=test%20product%20description
        &pr1ca=hardware
        &pr1pr=100
        &pr1qt=1
        &pr2id=testsku2
        &pr2nm=another%20description
        &pr2ca=hardware
        &pr2pr=20
        &pr2qt=2
    

    Hope that helps!