Send data to Google Analytics with Measurement Protocol.

Overview

Strapi Measurement Protocol

Send data to Google Analytics with Measurement Protocol.

Strapi Discord NPM Version Monthly download on NPM

Table of Contents

๐Ÿšฆ Current Status

This package is currently under development and should be consider ALPHA in terms of state. I/We are currently accepting contributions and/or dedicated contributors to help develop and maintain this package.

For more information on contributing please see the contrib message below.

โœจ Features

The Google Analytics Measurement Protocol for Google Analytics 4 allows developers to make HTTP requests to send events directly to Google Analytics servers. This allows developers to measure how users interact with their business from any HTTP-enabled environment. Notably, this makes it easy to measure interactions that happen server-to-server.

measurement_protocol_sequence_diagram

๐Ÿ– Installation

Add plugin dependency

yarn add strapi-plugin-measurement-protocol

Configure the plugin

// file: config/plugins.js
module.exports = ({ env }) => ({
  // ...
  "measurement-protocol": {
    config: {
      apiSecret: '',
      measurementId: '',
      useValidationServer: false,
    }
  },
  // ...
}
  • apiSecret - Required. An API SECRET generated in the Google Analytics UI. To create a new secret, navigate to:

Admin > Data Streams > choose your stream > Measurement Protocol > Create

  • measurementId - Required. The measurement ID associated with a stream. Found in the Google Analytics UI under:

Admin > Data Streams > choose your stream > Measurement ID

๐Ÿšš Usage

Full event list: https://developers.google.com/analytics/devguides/collection/protocol/ga4/reference/events

Frontend usage

gtag('event', 'add_payment_info');

gtag('get', 'G-XXXXXXXXX', 'client_id', (clientId) => {
  fetch('https://strapi.example.com/api/measurement-protocol/collect', {
    method: 'POST',
    body: JSON.stringify({
      client_id: clientId, 
      events: [{name: "add_payment_info"}]
    })
  })
});

The /api/measurement-protocol/collect endpoint will bind the client_id with the connected strapi user id more info: https://developers.google.com/analytics/devguides/collection/protocol/ga4/user-properties?client_type=gtag

Backend usage

strapi
  .plugin('measurement-protocol')
  .service('gtag')
  .send({
    // payload
  });

full event reference: https://developers.google.com/analytics/devguides/collection/protocol/ga4/reference/events

Contributing

I/We are actively looking for contributors, maintainers, and others to help shape this package. As this plugins sole purpose within the Strapi community is to be used by other developers and plugin maintainers to get fast responses time.

If interested please feel free to email the lead maintainer Sacha at: [email protected] or ping stf#3254 on Discord.

License

See the LICENSE file for licensing information.

You might also like...

๐ŸŒฌ๏ธ Server to collect and send air quality data.

๐ŸŒฌ๏ธ Server to collect and send air quality data.

Air Quality Measurement ๐ŸŒฌ๏ธ Server to collect and send air quality data. ๐Ÿ“ Table of Contents About How it works Usage Getting Started Built Using Aut

Oct 12, 2022

Apilytics for Node.js - Easy API analytics for Node backends

apilytics-node Apilytics is a service that lets you analyze operational, performance and security metrics from your APIs without infrastructure-level

Sep 2, 2022

Credence Analytics - REST- API - Assignment

Credence Analytics - REST- API - Assignment

Backend Assignment Position: Software Developer REST API Server โ— Youโ€™ll need to create an API server with CRUD based routes using NodeJS/Python โ— Using your API, users can Create, Read, Update or Delete data from the database

Nov 14, 2022

An open-source analytics library to measure user events the hassle-free way.

An open-source analytics library to measure user events the hassle-free way.

walker.js The walker.js is an open-source event tracker for all tools. Easy, standardized & flexible. Capture user events in the browser by setting HT

Dec 22, 2022

Minimal versions of popular analytics libraries. Reduce the impact of third-party scripts on your application.

minimal-analytics This project aims to provide minimal implementations of popular analytics libraries. It's aimed at users who want to reduce the impa

Dec 25, 2022

A Javascript based web application for monitoring, analytics and notifications

JELLYWATCH Jellywatch is a javascript web application for monitoring*, analytics** and notifications** inspired by tautulli for Jellyfin/Emby Media Se

Dec 28, 2022

ChainLook is a decentralized blockchain analytics platform based on TheGraph and IPFS.

ChainLook https://chainlook.xyz ChainLook is a decentralized blockchain analytics platform based on TheGraph and IPFS. You can create beautiful widget

Nov 21, 2022

waitlyst.js provides in-app widgets for collecting customer feedback & product analytics.

waitlyst.js provides in-app widgets for collecting customer feedback & product analytics.

waitlyst.js provides in-app widgets for collecting customer feedback & product analytics. Track every event on your app Understand your users and how

Dec 3, 2022

A decentralized protocol for indexing and querying data from DecentraMix's on chain contracts across all supported blockchains.

A decentralized protocol for indexing and querying data from DecentraMix's on chain contracts across all supported blockchains.

A decentralized protocol for indexing and querying data from DeMix contracts across all supported blockchains.

May 3, 2022
Comments
Owner
Strapi Community
Strapi Community
It shows an effective way to correct bus arrival information using data analytics based on Amazon Serverless such as Kiness Data Stream, Kinesis Data Firehose, S3, and Lambda.

Amazon Serverless๋ฅผ ์ด์šฉํ•œ ์‹ค์‹œ๊ฐ„ ๋ฒ„์Šค ์ •๋ณด ์ˆ˜์ง‘ ๋ฐ ์ €์žฅ ๋ณธ github repository๋Š” ๋ฒ„์Šค ์ •๋ณด๋ฅผ ์ฃผ๊ธฐ์ ์œผ๋กœ ์ˆ˜์ง‘ํ•˜์—ฌ ๋ถ„์„ํ•  ์ˆ˜ ์žˆ๋„๋ก, Amazon Serverless์ธ Amazon Kinesis Data Stream, Kinesis Data

John Park 4 Nov 13, 2022
Room impulse response measurement in the browser.

Room impulse response measurement - in the browser! Check it out on danielrudrich.github.io/Broom. Behind the scenes Broom uses the WebAudioAPI to pla

Daniel Rudrich 47 Sep 13, 2022
Google-Drive-Directory-Index | Combining the power of Cloudflare Workers and Google Drive API will allow you to index your Google Drive files on the browser.

?? Google-Drive-Directory-Index Combining the power of Cloudflare Workers and Google Drive will allow you to index your Google Drive files on the brow

Aicirou 127 Jan 2, 2023
Analytics and insights for data aggregated from multiple bridges and chains.

Inter-Bridge-Visualizer Analytics and insights for data aggregated from multiple bridges and chains. Website at bridgeexplorer.xyz Background Bridges

Verumlotus 8 Jul 11, 2022
Google Clone using NEXT JS ,SSR, Tailwind and Google API's to search data.

This is a Next.js project bootstrapped with create-next-app. Getting Started First, run the development server: npm run dev # or yarn dev Open http://

Hamnaikbalkhan 7 Sep 23, 2022
simple jquery Plugin that utilizes Google API to get data from a Place on Google Maps

jQuery Plugin to display Google Reviews of a Place on Google Maps this will get the 5 reviews, google offers you. But I need more than 5 reviews! if y

Simon Neutert 32 Dec 14, 2022
This branch is created to make receive and send data to api using async and await methods

Microverse-Leader-Board Project from module 2 week 4 This branch is created to make receive and send data to api using async and await methods Screens

Akshitha Reddy 6 Apr 22, 2022
A Leaderscore app that send data to an API created from Postman and allow users to save names and scores in a table. Built with JavaScript

Leaderboard The leaderboard website displays scores submitted by different players. It also allows you to submit your score. All data is preserved tha

Anicet Murhula 11 May 16, 2022
The leaderboard website displays scores submitted by different players. It also allows you to send and receive data from API. Build with JavaScript, CSS and HTML.

Leadboard The leaderboard website displays scores submitted by different players. It also allows you to submit your score. All data is preserved using

Fatima Ezzahra elmenoun 4 Jan 31, 2022