About GA4 Configuration fields
https://developers.google.com/analytics/devguides/collection/ga4/reference/config
GA4 has its few
client_id
stored as part of first-party analytics cookie for 2 year, use for identify each user.
gtag('set', 'client_id', '123456');
gtag('event', 'test_gtag_set', { test_id: 'client_id'});
The collect?v=2
request's query string key will be cid
. Big Query column is user_pseudo_id
, also the cookie _ga
value will be update to GA.1.1.123456
.
Update this value, the subsequence request will always set the same value since cookie updated.
language
by default using the window object's nagigator.language
's value.
gtag('set', 'language', 'en-ca');
gtag('event', 'test_gtag_set', { test_id: 'language'});
The collect?v=2
request's query string key will be ul
. BQ column is device.language
will be update to en-ca
. The navigator.language won' update.
page_location
By default using the window object's document.location
's value, not sure what condition need to update this value.
gtag('set', 'page_location', '/test2');
gtag('event', 'test_gtag_set', { test_id: 'page_location'});
The collect?v=2
request's query string key will be dl
. BQ column is event_params.page_location
will be update to /test2
.
page_referrer
By default using the window object's document.referrer
's value, if is direct come to the site, document.referrer
should be empty and BQ will have no value.
gtag('set', 'page_referrer', 'https://technoapple.com');
gtag('event', 'test_gtag_set', { test_id: 'page_referrer'});
The collect?v=2
request's query string key will be dr
. BQ column is event_params.page_referrer
will be update to https://technoapple.com
, because of page_referrer
has value, event_params
will add 2 more values, medium
value is referral
and source
has value is technoapple.com
.
page_title
By default using the window object's document.title
's value, not sure what condition need to update this value.
gtag('set', 'page_title', 'my title');
gtag('event', 'test_gtag_set', { test_id: 'page_title'});
The collect?v=2
request's query string key will be dt
. BQ column is event_params.page_title
will be update to my title
.
user_id
The user's id provide by the site.
gtag('set', 'user_id', '123');
gtag('event', 'test_gtag_set', { test_id: 'user_id'});
The collect?v=2
request's query string key will be uid
. BQ column is user_id
will be update to 123
. Once this value is set subsequent gtag request will always contains user_id as 123
.
user_properties
Additional user preference information, update to 25 additional user properties. name max is 24, value max is 36.
gtag('set', 'user_properties', {
"data1": "1 data"
});
gtag('event', 'test_gtag_set', { test_id: 'user_properties'});
The collect?v=2
request's query string key will be something start with up
, e.g. up.data1
. BQ column is user_properties
, it should contains the object data1
and value 1 data
.
gtag('config', 'G-NFY53GVWDK', {
'user_properties': {
"data_10": "10 data"
}
});
gtag('event', 'test_gtag_set', { test_id: 'user_properties'});