Page view

Page view

gtag page view

You can simply set your GA4 TAG_ID into gtag config, then it will automatically send the page view event to GA

gtag('config', 'TAG_ID');

If you want to change some tracking data in gtag, you can pass your data in the third parameter.

gtag('config', 'TAG_ID', {
  page_title: 'My Profile',
  page_location: 'https://example.com/me' // Include the full URL
});

Duplicate page view from gtag and Google Tag Manager

If you use Google Tag Manager to send the page view, you might need to close the page view event from gtag. Or it will send the duplicate page view event from the gtag and the Google Tag Manager.

1. Disable gtag page view

You can set send_page_view to false in the third parameter. Then the gtag will not send the page view anymore.

gtag('config', 'TAG_ID', {
  send_page_view: false
});

2. Disable Google Tag Manager page view

You can go to your Google Tag Manager setting for Google Analytics: GA4 Configuration. Then uncheck the Send a page view event when this configuration loads

Then the Google Tag Manager will not send the page view anymore.

Page view

page view manually

If you use the infinite scroll or something that will change your URL dynamic by using javascript. You might want to send the custom page view to Google Analytics.

You can send the gtag page_view event to Google Analytics by yourself.

gtag('event', 'page_view', {
  page_title: 'My Profile',
  page_location: 'https://example.com/me', // Include the full URL
  send_to: '<MEASUREMENT_ID>'
});

Reference