0

this description

https://developers.google.com/analytics/devguides/collection/gtagjs/events

gtag('event', <action>, {
  'event_category': <category>,
  'event_label': <label>,
  'value': <value>
});

is slightly different than this

https://developers.google.com/gtagjs/reference/api

gtag('event', '<event_name>', {<event_params>});

particularly the fact that the value property needs to be a non-negative integer is ignored in the latter.

Which guidelines should I follow ?

2

They're both actually the same. The second one in your question is just an abstraction - it shows less data but if you look farther down you can see they're setting app_name and screen_name where you would be setting event_category etc. It just depends on the specific type of event you're tracking and what data you want to capture. For website tracking you'll usually follow the specifics of the first - setting action, category, label, and optionally value gives you the maximum amount of data possible in standard GA event reports.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.