The most convenient way to do this is with the workflow "Request push subscriptions and welcome push", which is included as a template in Connectif. This workflow displays a modal window upon entering the page, containing a link to trigger the push subscription request in the browser. If accepted, the first welcome notification is sent to the user.
If we don't want to show that modal window and prefer the request to appear directly upon entering the website, we just need to place an inline with an HTML element, and inside that element, this code. No additional elements are required in the inline, as it will not be visible on the site.
<script> connectif.subscribeToPushNotifications(function (error){ if (!error){ connectif.managed.sendEvents([]); } }); </script>
Note
This article explains how to properly configure the ServiceWorker, which is an essential requirement for Web Push Notifications to work correctly.