Step 2: Configuring and Activating the Web Push Script
    • 1 Minute to read
    • Dark
      Light

    Step 2: Configuring and Activating the Web Push Script

    • Dark
      Light

    Article summary

    For the integration of the Web Push plugin, you need the JavaScript file "webpush.min.js."

    1. Download the JavaScript file webpush.min.js.

    2. In the JavaScript file "webpush.min.js," make the following adjustments:
      Example

      (function() {
          var wt_webpushConfig = window.wt_webpushConfig || {
      		serviceURL: 'jamie.c.shortest-route.com/charon',
              webpushScriptIncluded: false,
              useUserMatching: true,
              xKey: '<<Engage xKey>>',
              serviceWorkerScript: '/js/firebase-messaging-sw.js',
              includeFirebaseScripts: true,
              firebaseConfig: {
                  apiKey: '<<Firebase apiKey>>',
                  authDomain: '<<Firebase authDomain>>',
                  projectId: '<<Firebase projectId>>',
                  storageBucket: '<<Firebase storageBucket>>',
                  messagingSenderId: '<<Firebase messagingSenderId>>',
                  appId: '<<Firebase appId>>',
                  measurementId: '<<Firebase measurementId>>'
              }
          };
          
          /* ... */
      })();

      Parameter

      Description

      serviceURL

      Provide your Service URL:

      • eu_l3: jamie.g.shortest-route.com/charon

      • eu_emc: jamie.h.shortest-route.com/charon

      • us_emc: jamie.c.shortest-route.com/charon

      webpushScriptIncluded

      Enable if you already use Mapp Engage Web Push functionality. You do not need to provide the xKey or additional Firebase configurations in that case.

      useUserMatching

      Disable if you do not want to share user information between Mapp Engage and Mapp Intelligence. If disabled, segment exchange between Engage and Intelligence based on user interactions on your website, will not be possible.

      xKey

      Provide the xKey as given in your Mapp Engage account. Please note that you only need to provide it if you are not already using the Mapp Engage Web Push script. You can find this in your Engage account on Administration > Channels > Websites > Channel Info > SDK Key.

      serviceWorkerScript

      Add the URL to the service worker you use for your push notifications (see Step 1: Configuration Firebase and Service Worker).

      includeFirebaseScripts

      Leave this enabled if you have not yet included the necessary firebase scripts on your website.

      apiKey




      Please include as specified in your firebase console in project settings > general > my app > configuration.

      authDomain

      projectId

      storageBucket

      messagingSenderId

      appId

      measurementId

      Watch the following video for more details:

    3. Include the script file in your website, into your page, ideally before the closing body tag.

      Example

      <html>
          <head>
              <title>title of the page</title>
          </head>
          <body>
              The content of your website is placed here.
              
              <script type="text/javascript" src="js/webpush.min.js"></script>
          </body>
      </html>


    Was this article helpful?