Paweł Zawadzki
Paweł Zawadzki

Reputation: 13

Google Analytics Measurement Protocol Large Transactions

Is it possible to split your transaction using Google Analytics Measurement Protocol and still have accurate results?

Problem to tackle: Big Order which exceeds 8000K limit in protocol. I can't shrink them at the moment. I could replace product names to SKU's, but they are necessary.

My solution:

  1. Split products in batches and send them as purchase events. This time I have to set up Revenue = 0 as I don't want to double the order value.

  2. Send 'event' request with basic transaction data: Revenue and Tax. I have to do it in separate call as order can have promo code applied, or value just will be different than product prices.

Example will explain it better. I am using Enhanced Ecommerce

Example:

// Product data 1
v=1
&tid=UA-XXXXXXX-XX
&cid=3957780
&t=event
&ti=0003170270
&ta=24
&tr=0
&ec=WebFlow
&ea=Product+Purchase
&el=Product+Information+part+0
&pr1id=PRODUCTCODE48781876
&pr1nm=Classroom+Store+12+Bin+Mobile
&pr1pr=219.99
&pr1qt=3
&pr2id=PRODUCTCODE48781850
&pr2nm=Classroom+Store+9+Bin+Mobile
&pr2pr=174.99
&pr2qt=1
&pr3id=PRODUCTCODE1001651
&pr3nm=Hotpoint+Electronic+Cooker
&pr3pr=24.99
&pr3qt=3
&pr4id=PRODUCTCODE248696
&pr4nm=Snap+Together+Letter+Blocks
&pr4pr=59.99
&pr4qt=3
&pa=purchase
&dh=Host
&dp=Page
&dt=Title


// Product data 2
v=1
&tid=UA-XXXXXXX-XX
&cid=3957780
&t=event
&ti=0003170270
&ta=24
&tr=0
&ec=WebFlow
&ea=Product+Purchase
&el=Product+Information+part+1
&pr1id=PRODUCTCODE48789936
&pr1nm=Pedal+Trike+X+2
&pr1pr=299.98
&pr1qt=5
&pr2id=PRODUCTCODE1004354
&pr2nm=Talking+Tubes
&pr2pr=15.99
&pr2qt=3
&pr3id=PRODUCTCODE1004360
&pr3nm=Talking+Tubes+Exchange+Group+Pack
&pr3pr=49.99
&pr3qt=5
&pr4id=PRODUCTCODE176390
&pr4nm=Winter+Feathers
&pr4pr=2.05
&pr4qt=2
&pa=purchase
&dh=Host
&dp=Page
&dt=Title

// Product data 3
v=1
&tid=UA-XXXXXXX-XX
&cid=3957780
&t=event
&ti=0003170270
&ta=24
&tr=0
&ec=WebFlow
&ea=Product+Purchase
&el=Product+Information+part+2
&pr1id=PRODUCTCODE176364
&pr1nm=Natural+Feathers
&pr1pr=3.53
&pr1qt=3
&pr2id=PRODUCTCODE137169
&pr2nm=Yellow+Feathers+X+25G
&pr2pr=1.8
&pr2qt=5
&pr3id=PRODUCTCODE326475
&pr3nm=Phunky+Foods+Plate+Health+Mat
&pr3pr=46.99
&pr3qt=1
&pr4id=PRODUCTCODE48808565
&pr4nm=Back2Nature+Leaf+See+N+Store
&pr4pr=139.99
&pr4qt=2
&pa=purchase
&dh=Host
&dp=Page
&dt=Title

// Product data 4
v=1
&tid=UA-XXXXXXX-XX
&cid=3957780
&t=event
&ti=0003170270
&ta=24
&tr=0
&ec=WebFlow
&ea=Product+Purchase
&el=Product+Information+part+3
&pr1id=PRODUCTCODE48789975
&pr1nm=Scooter+And+Tandem+Trike
&pr1pr=329.98
&pr1qt=2
&pa=purchase
&dh=Host
&dp=Page
&dt=Title

// Transaction data
v=1
&tid=UA-XXXXXXX-XX
&cid=3957780
&t=event
&ti=0003170270
&ta=24
&tr=4678.01
&tt=779.67
&ec=WebFlow
&ea=Product+Purchase
&el=Big+Transaction+Basic+Information
&pa=purchase
&dh=Host
&dp=Page
&dt=Title

I've split it in smaller batches, becasuse it would be problematic to every time I want to test something, create request for 150 products.

Problems I am having:

  1. Transaction is either not visible at all, or disappears after I manage to see it for couple of minutes in GA panel
  2. Transaction is visible, Revenue is correct, tax as well, but only first batch of proudcts is visible in panel.

I also tried to switch the order of calls - first call with revenue and tax and then products. Similiar issues. I am really struggling with this since couple of days and it's extremely annoying with it's lack of consistence.

Is it happening because I am doing something entirely stupid? Is it even achievable?

Thanks for any advice!!

Example transaction:

Transaction

It doesn't show any products:

Product List

Upvotes: 1

Views: 434

Answers (2)

Paweł Zawadzki
Paweł Zawadzki

Reputation: 13

@Eduardo Thanks for your quick reply.

Idea #1) Your first Idea completely makes sense and I actually thought about doing it this way. It would solve probably 98% cases, but It would still fail when orders are really big. I know that I am pushing the boundary of rationality here, but we have cases of really high orders in terms of amount various different product.

Idea #2) That would be the best way to get there, but some of metrics as you said would be off. It should make big problem though.

I think I will do kind of hybrid solution. When order doesn't hit the limit - do the normal call, when it hits the limit within some size difference, fall back to SKUs - if it still doesn't fit, do the call without product data at all or split the order.

Thanks for help once again, because this problem was driving me nuts.

Upvotes: 0

Eduardo
Eduardo

Reputation: 22834

That's not recommended. Here are 2 ideas.

Idea #1)

You send all transaction data within the same hit and strip all product information, send only the SKU, and then use DataImport to import the data for each product. This will help you reduce your hit size considerably.

Idea #2)

Split your transaction into multiple "virtual transactions". Give them virtual transaction Ids eg: if you have a transaction with Id=123123 instead you fire 3 transactions: 123123-part1, 123123-part2, 123123-part3. Analysis might be a bit harder, and some metrics might be off, like transactions/user. But in geenral you should get transaction level data divided into multiple rows and product level data with no problem.

About the data not showing up I could see 3 possibilities.

  • Since this is not a recommended thing you are doing the behavior can be uinexpected and maybe GA is just dropping that data; OR
  • You are just not waiting long enough, some reports can take up to 48h to process; OR
  • Your hits are invalid, maybe missing a required ecommerce parameter. You can use the Hit Validator to issue send example hits and see if there are any errors or missing parameters in them.

Upvotes: 1

Related Questions