Title: Tag Manager/Analytics
Last modified: August 5, 2017

---

# Tag Manager/Analytics

 *  Resolved [rodrigo07](https://wordpress.org/support/users/rodrigo07/)
 * (@rodrigo07)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/tag-manageranalitycs/)
 * Hi!
 * Basically, I want that when a user subscribes an event is triggered so I can 
   track it with Google analytics.
 * I read this page: [https://documentation.onesignal.com/v3.0/docs/web-push-sdk#section–notificationpermissionchange-](https://documentation.onesignal.com/v3.0/docs/web-push-sdk#section–notificationpermissionchange-)
 * But I don’t know where to put that javascript code!
 * Can you help me? Thanks!
    -  This topic was modified 8 years, 9 months ago by [rodrigo07](https://wordpress.org/support/users/rodrigo07/).

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [OneSignal Push Notifications](https://wordpress.org/support/users/onesignal/)
 * (@onesignal)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/tag-manageranalitycs/#post-9389099)
 * Hey rodrigo07,
 * You can install a WordPress plugin like Insert Headers and Footers ([https://wordpress.org/plugins/insert-headers-and-footers/](https://wordpress.org/plugins/insert-headers-and-footers/)),
   visit Settings -> Insert Headers and Footers, and in either box (not both), add:
 *     ```
       var OneSignal = window.OneSignal || [];
       OneSignal.push(function() {
         OneSignal.on('notificationPermissionChange', function(permissionChange) {
           var currentPermission = permissionChange.to;
           console.log('New permission state:', currentPermission);
           /* Output: New permission state: granted */
           /* ADD YOUR GOOGLE ANALYTICS EVENT HERE */
         });
       });
       ```
   
 *  Plugin Author [OneSignal Push Notifications](https://wordpress.org/support/users/onesignal/)
 * (@onesignal)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/tag-manageranalitycs/#post-9389101)
 * You’ll need to change the code above of course to actually add your Google Analytics
   code.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Tag Manager/Analytics’ is closed to new replies.

 * ![](https://ps.w.org/onesignal-free-web-push-notifications/assets/icon.svg?rev
   =3003897)
 * [OneSignal - Web Push Notifications](https://wordpress.org/plugins/onesignal-free-web-push-notifications/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/onesignal-free-web-push-notifications/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/onesignal-free-web-push-notifications/)
 * [Active Topics](https://wordpress.org/support/plugin/onesignal-free-web-push-notifications/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/onesignal-free-web-push-notifications/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/onesignal-free-web-push-notifications/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [OneSignal Push Notifications](https://wordpress.org/support/users/onesignal/)
 * Last activity: [8 years, 9 months ago](https://wordpress.org/support/topic/tag-manageranalitycs/#post-9389101)
 * Status: resolved