Crates.io | ga-v4-flattener |
lib.rs | ga-v4-flattener |
version | 0.4.0 |
source | src |
created_at | 2018-09-29 00:26:07.829476 |
updated_at | 2021-02-08 02:06:32.639766 |
description | Converts Google Analytics API v4 reports to flat/delimited data. |
homepage | |
repository | https://github.com/C-Saunders/google_analytics_v4_report_flattener |
max_upload_size | |
id | 87064 |
size | 25,551 |
This library exposes two public functions that accept a Google Analytics Core Reporting v4 response string (string of the JSON data) and transform the data into something easier to use.
to_delimited(raw_report_response: &str, delimiter: &str) -> Result<Vec<String>, serde_json::Error>
Converts a report response to a collection of delimited reports. You can specify any delimiter string you'd like.
["\"ga:deviceCategory\",\"ga:sessions\"\n\"desktop\",43\n\"mobile\",1\n"]
to_flat_json(raw_report: &str) -> Result<serde_json::value::Value, serde_json::Error>
Converts a report response to an array of "flat JSON" responses.
[
[{
"ga:deviceCategory": "desktop",
"ga:sessions": 21
}, {
"ga:deviceCategory": "mobile",
"ga:sessions": 84
}],
[{
"ga:country": "Mexico",
"ga:bounces": 9213
}, {
"ga:country": "Canada",
"ga:bounces": 407
}]
]
Issues and pull requests welcome. Please be nice.
cargo test
cargo bench
rustfmt