Website integration

What is website integration?

It is responsible for application functionalities such as collecting subscribers, sending push campaigns or automation.

In order to integrate a project you have to place a script generated in PushPushGo application in the website source code of your project and place the service worker file on the root path of the server.

Another option is to use the basic integration, in which you only need to place the script in the website source code of your project, while the service worker will be placed in PushPushGo subdomain and made available to the client, e.g.

Integration script

Integration script is a script placed in the website code and loaded asynchronously after entering the integrated page. It is responsible for downloading project configuration data from the PushPushGo server referring to:

  • Subscription Form - pop-up window displayed after entering the integrated page, asks for the user's consent to receive notifications,

  • Geolocation - pop-up window displayed after subscribing to notifications, asks for the user's permission to share his location, saves the location based on the GeoLocation API (W3C),

  • Google Analytics - sends events to the existing,

  • Data Layer - sends events to the existing DataLayer,

  • Color Tracking - if user is subscribed, captures the color from the element indicated in the selector,

  • Beacon - if user is subscribed, collects information based on selectors, session start date, session end date and visited url’s,

  • Default notification - notification displayed to subscriber if due to technical reasons it will not be possible do deliver push campaign,

  • Service Worker Path - service worker file path,

  • Fab Icon - a widget used to give consent/ remove consent to receive notifications.

These integration elements can be enabled or configured in the Project settings in the PushPushGo application.

Beacon & Default notification cannot be disabled.

Service worker

“A service worker is an event-driven worker registered against an origin and a path. Service workers essentially act as proxy servers that sit between web applications, the browser, and the network (when available). They are intended, among other things, to enable the creation of effective offline experiences, intercept network requests and take appropriate action based on whether the network is available, and update assets residing on the server. They will also allow access to push notifications and background sync APIs.” - MDN Web Docs

Our service worker implementation is based only on Push API.

If the user agrees to receive notifications through subscription form, then:

  • service worker is registered in the user's browser,

  • random Subscriber's Token with its VAPID key pair for data encryption is generated by provider and sent through HTTP request to the PushPushGo server,

  • subscriber is saved in the PushPushGo database by giving him an internal Subscriber ID which is returned in response and saved in IndexedDB for further identification,

  • based on HTTP headers, the subscriber is labeled in the PushPushGo database (operating system, language, browser, provider type, location guessed using GeoIPLookup).

In other words, the service worker is responsible for subscriber’s identification and notification delivery.

Last updated