Learn R Programming

measurementProtocol - an R library for sending server-side data to Google Analytics 4

The Measurement Protocol v2 is for sending data to Google Analytics 4.

This library enables the ability to use the API from R.

It also includes functions to use the measurement protocol to track events such as R library loads for package usage analytics.

Complement the package with googleAnalyticsR to read the data you send.

Install

Install from CRAN

install.packages("measurementProtocol")

Dev version from GitHub:

remotes::install_github("MarkEdmondson1234/measurementProtocol")

Usage

See the documentation on the measurementProtocol website: https://code.markedmondson.me/measurementProtocol/

You need a Google Analytics 4 account to send the hits to.

Copy Link

Version

Install

install.packages('measurementProtocol')

Monthly Downloads

26,836

Version

0.1.1

License

MIT + file LICENSE

Maintainer

Mark Edmondson

Last Published

March 4th, 2023

Functions in measurementProtocol (0.1.1)

mp_event_item

Create an Measurement Protocol Item Property for an Event
mp_send

Make a Measurement Protocol v2 request
mp_trackme

Opt in or out of package usage tracking
mp_cid

Generate a random client_id
mp_opt_in

Tracking opt-in for this package
mp_parse_json

Parse out objects into the Measurement Protocol v2 format for sending
mp_event

Create a Measurement Protocol Event