Last updated on 2025-03-13 05:51:49 CET.
Flavor | Version | Tinstall | Tcheck | Ttotal | Status | Flags |
---|---|---|---|---|---|---|
r-devel-linux-x86_64-debian-clang | 0.1.1 | 2.38 | 24.93 | 27.31 | OK | |
r-devel-linux-x86_64-debian-gcc | 0.1.1 | 1.89 | 20.33 | 22.22 | OK | |
r-devel-linux-x86_64-fedora-clang | 0.1.1 | 41.80 | OK | |||
r-devel-linux-x86_64-fedora-gcc | 0.1.1 | 41.10 | OK | |||
r-devel-macos-arm64 | 0.1.1 | 22.00 | OK | |||
r-devel-macos-x86_64 | 0.1.1 | 34.00 | OK | |||
r-devel-windows-x86_64 | 0.1.1 | 4.00 | 66.00 | 70.00 | ERROR | |
r-patched-linux-x86_64 | 0.1.1 | OK | ||||
r-release-linux-x86_64 | 0.1.1 | 2.38 | 23.66 | 26.04 | OK | |
r-release-macos-arm64 | 0.1.1 | 23.00 | OK | |||
r-release-macos-x86_64 | 0.1.1 | 29.00 | OK | |||
r-release-windows-x86_64 | 0.1.1 | 4.00 | 46.00 | 50.00 | OK | |
r-oldrel-macos-arm64 | 0.1.1 | OK | ||||
r-oldrel-macos-x86_64 | 0.1.1 | 29.00 | OK | |||
r-oldrel-windows-x86_64 | 0.1.1 | 4.00 | 52.00 | 56.00 | OK |
Version: 0.1.1
Check: examples
Result: ERROR
Running examples in 'measurementProtocol-Ex.R' failed
The error most likely occurred in:
> ### Name: mp_parse_json
> ### Title: Parse out objects into the Measurement Protocol v2 format for
> ### sending
> ### Aliases: mp_parse_json mp_parse_gtm mp_pubsub
>
> ### ** Examples
>
>
> demo_json <- system.file("example", "pubsub-ga4.json", package = "measurementProtocol")
> demo_list <- jsonlite::fromJSON(demo_json)
>
>
> # extract the event_name
> name_f <- function(x) x[["event_name"]]
>
> # extract client_id
> client_id_f <- function(x) x[["client_id"]]
>
> # extract user_id
> user_id_f <- function(x) x[["user_id"]]
>
> # simple event
> mp_parse_json(demo_list,
+ name_f,
+ client_id_f = client_id_f,
+ user_id_f = user_id_f)
ℹ 2025-03-12 15:40:21.420759 > Received JSON: { "x-ga-protocol_version": "2", "x-ga-measurement_id": "G-43MDXK6CLZ", "x-ga-gtm_version": "2reba1", "x-ga-page_id": 1331862949, "screen_resolution": "1280x720", "language": "en-us", "client_id": "106601226.163731234", "x-ga-request_count": 1, "page_location": "https://code.markedmondson.me/shiny-cloudrun/", "page_referrer": "https://www.google.com/", "page_title": "Shiny on Google Cloud Run - Scale-to-Zero R Web Apps · Mark Edmondson", "ga_session_id": "1637391234", "ga_session_number": 3, "x-ga-mp2-seg": "0", "event_name": "page_view", "x-ga-system_properties": { "ss": "1" }, "debug_mode": "true", "ip_override": "123.456.789.111", "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)", "x-ga-gcs-origin": "not-specified", "user_id": "random-user" }
$raw
$raw$`x-ga-protocol_version`
[1] "2"
$raw$`x-ga-measurement_id`
[1] "G-43MDXK6CLZ"
$raw$`x-ga-gtm_version`
[1] "2reba1"
$raw$`x-ga-page_id`
[1] 1331862949
$raw$screen_resolution
[1] "1280x720"
$raw$language
[1] "en-us"
$raw$client_id
[1] "106601226.163731234"
$raw$`x-ga-request_count`
[1] 1
$raw$page_location
[1] "https://code.markedmondson.me/shiny-cloudrun/"
$raw$page_referrer
[1] "https://www.google.com/"
$raw$page_title
[1] "Shiny on Google Cloud Run - Scale-to-Zero R Web Apps · Mark Edmondson"
$raw$ga_session_id
[1] "1637391234"
$raw$ga_session_number
[1] 3
$raw$`x-ga-mp2-seg`
[1] "0"
$raw$event_name
[1] "page_view"
$raw$`x-ga-system_properties`
$raw$`x-ga-system_properties`$ss
[1] "1"
$raw$debug_mode
[1] "true"
$raw$ip_override
[1] "123.456.789.111"
$raw$user_agent
[1] "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"
$raw$`x-ga-gcs-origin`
[1] "not-specified"
$raw$user_id
[1] "random-user"
$mp_event
==GA4 MP Event
{
"name": "page_view"
}
$user
$user$client_id
[1] "106601226.163731234"
$user$user_id
[1] "random-user"
$user$user_properties
NULL
attr(,"class")
[1] "mp_parse_json" "list"
>
> # params could be assumed to be everything not a event_name of client_id
> # also not allowed any starting with reserved 'ga_'
> params_f <- function(x){
+ x_names <- names(x)[grepl("^x-", names(x))]
+ ga_names <- names(x)[grepl("^ga_", names(x))]
+ x[setdiff(names(x), c("client_id","user_id" ,"event_name", x_names, ga_names))]
+ }
>
> # parse including params (could include items as well)
> parsed_event <- mp_parse_json(demo_list,
+ name_f,
+ params_f = params_f,
+ client_id_f = client_id_f,
+ user_id_f = user_id_f)
ℹ 2025-03-12 15:40:21.453677 > Received JSON: { "x-ga-protocol_version": "2", "x-ga-measurement_id": "G-43MDXK6CLZ", "x-ga-gtm_version": "2reba1", "x-ga-page_id": 1331862949, "screen_resolution": "1280x720", "language": "en-us", "client_id": "106601226.163731234", "x-ga-request_count": 1, "page_location": "https://code.markedmondson.me/shiny-cloudrun/", "page_referrer": "https://www.google.com/", "page_title": "Shiny on Google Cloud Run - Scale-to-Zero R Web Apps · Mark Edmondson", "ga_session_id": "1637391234", "ga_session_number": 3, "x-ga-mp2-seg": "0", "event_name": "page_view", "x-ga-system_properties": { "ss": "1" }, "debug_mode": "true", "ip_override": "123.456.789.111", "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)", "x-ga-gcs-origin": "not-specified", "user_id": "random-user" }
> parsed_event
$raw
$raw$`x-ga-protocol_version`
[1] "2"
$raw$`x-ga-measurement_id`
[1] "G-43MDXK6CLZ"
$raw$`x-ga-gtm_version`
[1] "2reba1"
$raw$`x-ga-page_id`
[1] 1331862949
$raw$screen_resolution
[1] "1280x720"
$raw$language
[1] "en-us"
$raw$client_id
[1] "106601226.163731234"
$raw$`x-ga-request_count`
[1] 1
$raw$page_location
[1] "https://code.markedmondson.me/shiny-cloudrun/"
$raw$page_referrer
[1] "https://www.google.com/"
$raw$page_title
[1] "Shiny on Google Cloud Run - Scale-to-Zero R Web Apps · Mark Edmondson"
$raw$ga_session_id
[1] "1637391234"
$raw$ga_session_number
[1] 3
$raw$`x-ga-mp2-seg`
[1] "0"
$raw$event_name
[1] "page_view"
$raw$`x-ga-system_properties`
$raw$`x-ga-system_properties`$ss
[1] "1"
$raw$debug_mode
[1] "true"
$raw$ip_override
[1] "123.456.789.111"
$raw$user_agent
[1] "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"
$raw$`x-ga-gcs-origin`
[1] "not-specified"
$raw$user_id
[1] "random-user"
$mp_event
==GA4 MP Event
{
"name": "page_view",
"params": {
"screen_resolution": "1280x720",
"language": "en-us",
"page_location": "https://code.markedmondson.me/shiny-cloudrun/",
"page_referrer": "https://www.google.com/",
"page_title": "Shiny on Google Cloud Run - Scale-to-Zero R Web Apps · Mark Edmondson",
"debug_mode": "true",
"ip_override": "123.456.789.111",
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"
}
}
$user
$user$client_id
[1] "106601226.163731234"
$user$user_id
[1] "random-user"
$user$user_properties
NULL
attr(,"class")
[1] "mp_parse_json" "list"
>
> # sending to a debug endpoint
> # preferably set this in .Renviron
> Sys.setenv(MP_SECRET="MY_SECRET")
>
> # replace with your GA4 settings
> my_measurement_id <- "G-1234"
> my_connection <- mp_connection(my_measurement_id)
> mp_send(parsed_event$mp_event,
+ client_id = parsed_event$user$client_id,
+ user_id = parsed_event$user$user_id,
+ user_properties = parsed_event$user$user_properties,
+ connection = my_connection,
+ debug_call = TRUE)
ℹ 2025-03-12 15:40:21.517818 > MP Request: https://www.google-analytics.com/debug/mp/collect?measurement_id=G-1234&api_secret=MY_SECRET { "client_id": "106601226.163731234", "user_id": "random-user", "non_personalized_ads": true, "events": [ { "name": "page_view", "params": { "screen_resolution": "1280x720", "language": "en-us", "page_location": "https://code.markedmondson.me/shiny-cloudrun/", "page_referrer": "https://www.google.com/", "page_title": "Shiny on Google Cloud Run - Scale-to-Zero R Web Apps · Mark Edmondson", "debug_mode": "true", "ip_override": "123.456.789.111", "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)" } } ] }
Error in curl::curl_fetch_memory(url, handle = handle) :
Timeout was reached [www.google-analytics.com]: SSL/TLS connection timeout
Calls: mp_send ... request_fetch.write_memory -> <Anonymous> -> raise_libcurl_error
Execution halted
Flavor: r-devel-windows-x86_64
Version: 0.1.1
Check: tests
Result: ERROR
Running 'testthat.R' [11s]
Running the tests in 'tests/testthat.R' failed.
Complete output:
> library(testthat)
> library(measurementProtocol)
>
> test_check("measurementProtocol")
i 2025-03-12 15:40:32.751653 > MP Request: https://www.google-analytics.com/debug/mp/collect?measurement_id=G-43MDXK6CLZ&api_secret=MY_SECRET { "client_id": "1234567", "non_personalized_ads": true, "events": [ { "name": "an_event" } ] }
[ FAIL 1 | WARN 0 | SKIP 0 | PASS 0 ]
══ Failed tests ════════════════════════════════════════════════════════════════
── Error ('test_mp.R:13:3'): Measurement Protocol Hits ─────────────────────────
<curl_error_operation_timedout/curl_error/error/condition>
Error in `curl::curl_fetch_memory(url, handle = handle)`: Timeout was reached [www.google-analytics.com]: SSL/TLS connection timeout
Backtrace:
▆
1. ├─measurementProtocol::mp_send(...) at test_mp.R:13:3
2. │ └─httr::POST(...)
3. │ └─httr:::request_perform(req, hu$handle$handle)
4. │ ├─httr:::request_fetch(req$output, req$url, handle)
5. │ └─httr:::request_fetch.write_memory(req$output, req$url, handle)
6. │ └─curl::curl_fetch_memory(url, handle = handle)
7. └─curl:::raise_libcurl_error(...)
[ FAIL 1 | WARN 0 | SKIP 0 | PASS 0 ]
Error: Test failures
Execution halted
Flavor: r-devel-windows-x86_64