Skip to main content

GA4 gtag

This is a reference of reverse-engineered /g/collect AKA gtag protocol.

Method

POST

URL

https://www.google-analytics.com/g/collect

Query Parameters

Request Parameters

ParameterTypeDescriptionRequired
vstringProtocol VersionYes
tidstringTracking/Property ID - GA4 property identifier (e.g., G-XXXXXXXXXX)Yes
gtmstringGTM Has Info - indicates Google Tag Manager informationNo
_pint64Random Page Load Hash - UTC Unix timestamp of the page load, in millisecondsYes
srstringScreen Resolution - e.g., "1920x1080"No
ulstringUser Language - e.g., "en-us"No
dhstringDocument Hostname - hostname of the pageNo
cidstringClient ID - unique identifier for the clientYes
_sint64Hit Counter - indicates this is the nth hit/event sent in the current sessionNo
richsstssestringrichsstsse parameterNo

Event Parameters

ParameterTypeDescriptionRequired
enstringEvent Name - name of the event being trackedYes
_etint64Engagement Time - time user engaged with the page in millisecondsNo
ep.*stringEvent Parameter (String) - custom event parameterNo
epn.*numberEvent Parameter (Number) - custom numeric event parameterNo
_cboolis Conversion - indicates if event is a conversionNo
_eeboolExternal Event - indicates if event is externalNo

Shared Parameters

ParameterTypeDescriptionRequired
dlstringDocument Location - URL of the pageNo
dtstringDocument Title - title of the pageNo
drstringDocument Referrer - referrer URLNo
_eustringEvent UsageNo
_edidstringEvent Debug IDNo
_dbgboolis Debug - indicates debug modeNo
irboolIgnore Referrer - if present and true, referrer is ignored. GA4 docsNo
ttstringTraffic TypeNo
gcsstringEncodes the current google consent status in the format G<FunctionalStorageStatus><AdStorageStatus><AnalyticsStorageStatus>No
gcustringGoogle Consent UpdateNo
gcutstringGoogle Consent Update TypeNo
gcdstringGoogle Consent DefaultNo
_glvboolis Google Linker ValidNo

E-commerce Parameters

ParameterTypeDescriptionRequired
custringCurrency Code - e.g., "USD", "EUR"No
ep.affiliationstringAffiliation - store or affiliationNo
epn.valuenumberTransaction Revenue - total transaction valueNo
epn.taxnumberTransaction TaxNo
epn.shippingnumberTransaction ShippingNo
pr[0-9]{1,200}objectItem - product/item data (supports up to 200 items)No
pistringPromotion IDNo
pnstringPromotion NameNo
cnstringCreative NameNo
csstringCreative SlotNo
listringLocation IDNo

Campaign Attribution Parameters

ParameterTypeDescriptionRequired
cmstringCampaign Medium - e.g., "cpc", "email"No
csstringCampaign Source - e.g., "google", "newsletter"No
cnstringCampaign NameNo
ccstringCampaign ContentNo
ctstringCampaign TermNo
ccfstringCampaign Creative FormatNo
cmtstringCampaign Marketing TacticNo
_rndstringGCLID DeduperNo

User & Session Parameters

ParameterTypeDescriptionRequired
uidstringUser ID - optional user identifierNo
_fidstringFirebase IDNo
sidstringSession ID - unique session, assigned by the client when session starts, then propagated to every eventYes
sctint64Session Count - number of sessions for the userNo
segint64Session Engagement - engagement level of the sessionNo
up.*stringUser Property(ies) - custom user propertiesNo
upn.*numberUser Property Value - numeric user propertyNo
_fvboolFirst Visit - indicates first visitNo
_ssboolSession Start - indicates that this event starts the session. If present, always has value 1No
_fplcstringFirst Party Linker CookieNo
nsistringNew Session IDNo
gdidstringGoogle Developer IDNo
_ucstringUser CountryNo

Item Parameters

Used within item objects (pr[0-9]200):

ParameterTypeDescriptionRequired
idstringItem IDNo
nmstringItem NameNo
brstringItem BrandNo
castringItem Category Hierarchy 1No
c2stringItem Category Hierarchy 2No
c3stringItem Category Hierarchy 3No
c4stringItem Category Hierarchy 4No
c5stringItem Category Hierarchy 5No
prnumberItem PriceNo
qtnumberItem QuantityNo
vastringItem VariantNo
cpstringItem CouponNo
dsnumberItem DiscountNo
lnstringItem List NameNo
listringItem List IDNo
lpnumberItem List PositionNo
afstringItem AffiliationNo
lostringItem Location IDNo
cnstringItem Creative NameNo
csstringItem Creative SlotNo
pistringItem Promotion IDNo
pnstringItem Promotion NameNo

Client Parameters

Client Hints data:

ParameterTypeDescriptionRequired
uaastringUser Agent Architecture - e.g., "x86"No
uabstringUser Agent Bitness - e.g., "64"No
uafvlstringUser Agent Full Version ListNo
uambboolUser Agent Mobile - indicates if mobileNo
uamstringUser Agent Model - device modelNo
uapstringUser Agent Platform - e.g., "Windows"No
uapvstringUser Agent Platform VersionNo