Open martijnvv opened 4 years ago
Does this occur with other hits? The payload data is encoded before being sent via utils::URLencode(x, reserved=TRUE)
but perhaps it is not working for nested hits?
I've only seen this occur to values in the e-commerce object. Pageview and event values seem to work fine.for example, in this example the dp parameter is returned as /tracks_submitted.
I'm trying to replicate the issue. Does this code look similar to your example?
ee <- gmr_enhanced_ecom("purchase",
transaction_id = "rerer",
revenue = 4300.23,
product_sku = c("sku4","sku23","sku7"),
product_name = c("prod A",
"prod B",
"prod C/yeah"))
req <- gmr_hit_page(url_path = "/checkout",
enhanced_ecom = ee)
which gives
Debug mode
List of 15
$ ds : chr "googleMeasureR"
$ cid : chr "d378217a-fa91-11e9-80c1-ac87a30fc0b7"
$ dp : chr "%2Fcheckout"
$ pa : chr "purchase"
$ tr : chr "4300.23"
$ ti : chr "rerer"
$ pr1id: chr "sku4"
$ pr2id: chr "sku23"
$ pr3id: chr "sku7"
$ pr1nm: chr "prod%20A"
$ pr2nm: chr "prod%20B"
$ pr3nm: chr "prod%20C%2Fyeah"
$ v : chr "1"
$ tid : chr "UA-XXXX"
$ t : chr "pageview"
Yes, in this format, only used one product with more additional variables.
This appears to happen with all variables, also when firing events (label, action, category). I only see the page value (ie "page value") looking fine in GA.
It appears that the utils::URLencode(x, reserved=TRUE)
function is causing issues with eec and regular events. Once this is commented out, the events and pageviews are sent to GA just fine.
Might be an easy fix.
Seems contradictory to the GA documentation (https://developers.google.com/analytics/devguides/collection/protocol/v1/reference#encoding), but works nonetheless
Hi there. Very late to this party (Nice to see you here @martijnvv). I am also seeing encoding issues for the non-eec variables. So for instance event category will show "%20" in GA when I include spaces.
It's kind of an old issue, but if I remember this correctly, I fixed it locally by updating the gmr_hit_event function:
`gmr_hit_event <- function(category, action, label = NULL, value = NULL, interaction = TRUE,
...){
payload_data <- list( ds = "googleMeasureR", cid = gmr_uuid(), ec = category, ea = action, el = label, ev = value, dp = "/event", ni = if(interaction) 0L else 1L # is 1 if NOT interactive... )
payload_data <- override_list(payload_data, ...)
gmr_post(payload_data, hittype = "event")
}`
Might be helpful.
Not just 'gmr_hit_event' for me. Also 'gmr_post'. For example: gmr_post(list(t= "pageview", cid = gmr_uuid(), tid = "UA-999999-1", dp = "/mpr", dt = "Hello 001"))
will result in "Hello%20001" in GA.
That could be. Only used it for events, not pageviews.
I can imagine, the utils::URLencode(x, reserved=TRUE)
part is causing issues for all events though. As mentioned earlier in this issue
Thanks.
Whenever I send in product values as part of an e-commerce transaction hit, they are showing up in my reports encoded. If I send them through a browser hit (copy pasted from debug) they show up decoded in my GA reports. See example of report here. Top one through browser, bottom one through R. Prefixed a z to differentiate the hits in GA.
Hit sent: /debug/collect?ds=googleMeasureR&cid=1e8c4cea-f8b7-11e9-845e-5f049fc04066&dp=%2Ftracks_submitted&pa=purchase&ti=z123456789&pr1id=z4321_1%202&pr1nm=zThis%20is%20a%27test_hit%21&pr1ca=zcategory%20123%20%21&pr1pr=1200&fl=0&v=1&tid=UA-30688293-8&t=pageview
Output in R debug mode: