Yes, this can be accomplished through Google Analytics. For both Universal Analytics and GA4, Google provides a JavaScript code, known as the tracking code, which collects data about your site.
For Universal Analytics, the tracking code could be customized for specific events. However, instead of directly manipulating the code, custom events are typically created within the Google Analytics (GA) interface. You can set up new goals via the “Admin” section under “Goals” and then set the type as “Destination”. You would then specify the URLs of the pages which would count as an achievement of the goal.
In GA4, Google has moved towards an event-based model. The global site tag (gtag.js) that GA4 uses allows you to send event data to Google Analytics. Event tracking can be configured directly in the interface without requiring modification of the tracking code on your website. Both these scripts (Universal and GA4) should be placed in the footer of your website pages to track all necessary data for a session.
However, as you are trying to setup an event or a goal that includes viewing of multiple pages, it is recommended to make use of ‘Funnel Analysis’ in GA4 as it allows for a sequence of actions a user took, while goals in Universal Analytics work better for single action targets.
Please note that getting this setup right may require more than just a simple copy-paste of the tracking code. To fulfil your specific need, understanding the setup, configuration, and interpretation of these data collection tools is essential. It’s advisable to consult with a Google Analytics certified professional or a similar expert for proper setup and utilization of these tools.