Google Analytics integration

I am trying to figure out how to implement the following instructions given to me by Google. I am part of a publisher program, they are running. This way I can get a notification as an event in Google Analytics each time I get a new Push subscriber. However I do not know where to put the javascript they provide below. Could you help me out?

Push Notification Subscription

This component will measure specific events to better identify users who clicked on a push notification subscription offer.

When a user successfully subscribes to push notifications, an event will be measured to capture the interaction of click and the article title where the push notification is clicked.

  1. Within your codebase create or locate the code associated with the Push Notification Subscription action. For example, this may be a code block that executes when a user clicks a button to subscribe to future push notifications.

  2. Add the following Javascript code snippet to the point in your code block where the user has successfully subscribed to push notifications. Change the variable to the actual article title present where the measuring event is fired:

    gtag(‘event’, ‘click’, {
    ‘event_category’: ‘NTG push notification’,
    ‘event_label’: ‘’,
    ‘non_interaction’ : false
    });