Send a screen_view event to measure a screen view in Google Analytics. For Google Analytics 4 properties, this event is equivalent to the Firebase screen_view
event on native Android or iOS apps.
For mobile Firebase apps, Analytics will log the class name of the UIViewController
or Activity
that is currently in focus. For web, Analytics will log the contents of the <title>
tag, or the value can be sent explicitly with a screen_name
property.
To send a screen_view
event from gtag.js to Google Analytics, use the event
command as follows:
gtag('event', 'screen_view', {<screen_name>});
where <screen_name>
is the name of the screen that you want associated with this view. For example, this command sends a screen_view
event with a screen_name
parameter of 'Home'.
gtag('event', 'screen_view', {
'screen_name' : 'Home'
});