This is an open-source implementation for the client-side protocol used by Google Analytics 4. When I mention "client-side" is because it must be differentiated with the official GA4 Measurement Protocol offered by Google.
This library implements the public Google Analytics 4 protocol to make possible to do a full server-side tracking using NODE/JS which is not actually possible with the official Measurement Protocol , which is meant only to augment the current GA4 data and it's not ready for doing a full tracking.
Main differences with the official offerser server-side protocol are:
If we compare this library with the official GTAG implementation.
import ga4mp from '@analytics-debugger/ga4mp'
const ga4track = ga4mp(["G-THYNGSTER"], {
user_id: undefined,
non_personalized_ads: true,
debug: true
});
<.script src="https://cdn.jsdelivr.net/npm/@analytics-debugger/ga4mp@latest/dist/ga4mp.umd.min.js">< /script>
const ga4track = ga4mp(["G-THYNGSTER"], {
user_id: undefined,
non_personalized_ads: true,
debug: true
});
const ga4mp = require('./dist/ga4mp')
const ga4track = ga4mp(["G-THYNGSTER"], {
user_id: undefined,
non_personalized_ads: true,
debug: true
});
Read more at: https://ga4mp.dev/