Learn business growth with Google Analytics 4 › Forums › Google Analytics 4 › Retrieving event data from Google tag API: A helpful guide › Reply To: Retrieving event data from Google tag API: A helpful guide
-
The gtag.js command “get” that you are trying is not supported, therefore your callback function will not be called. Instead, once gtag.js sends an event to Google Analytics, you are not able to retrieve it directly from the gtag.js API itself. Instead, you may use the Google Analytics Reporting API to fetch this data. The Google Analytics documentation provides guides for this. From here, you should be able to fetch user interactions in the form of events, and sort them by event label (which should correspond to your ‘offer_id’). You can then count the number of times each offer was viewed. Alternatively, in your Google Analytics dashboard, you can create a new report to display event labels and their counts. Infusing this with programming to make the report automatic would require sever-side programming languages such as Python or Java.