Frequently Asked Questions about Website Integration.
Yes, but since there is only one service worker allowed per domain, you need either:
- join both service workers together using importScript:
- or put them separately and point where the service worker from PushPushGo app is located (on your site) by providing its path and typing ‘/ppg_scope’ in service worker scope in project settings:
Yes, but since PWA will always have its own service worker and there is only one service worker allowed, you need to use one of the solutions from question above "I already have another service worker. Can I integrate with PushPushGo?".
Yes, you can integrate your website via GTM, but only basic integration will be possible, since you do not have access to the server root path.
Go to your Google Tag Manager and then:
- 1.Create a new tag. Select the “Custom html” type and paste the code from the Integration > Installation tab.
- 2.Open “Advanced settings” and enter “1” in “Tag firing priority”.
- 3.Set the trigger to “DOM Ready”.
- 4.Remember to publish changes.
If you want to change the service worker name, for example from ‘sw.js’ to ‘service-worker.js’:
If you want to change the directory where the sw.js file is located (for example, to ‘static/sw.js’):
- save service worker path in project settings as ‘/static/sw.js’ and service worker scope as ‘/static/’.
Remember - after setting scope different than ‘/’ (global), eg. ‘/static’, our application will work only on subpages in that scope or below, so:
- https://example.com/static - code will work here
- https://example.com/static/page1 - code will work here
- https://example.com/ - code won't work here
- https://example.com/cart - code won't work here
If you still want our code to work globally in that case, you have to set scope as default - ‘/’ and add the following response header: "Service-Worker-Allowed": "/" to subpage containing service worker.
You need to integrate each project by placing the integration script in the corresponding website subdirectory source code and service worker in the subdirectory folder of the server.
Then, change the service worker path & scope of every project in project settings accordingly. For example, for ‘your-site.com/en’ change service worker path to ‘/en/sw.js’ and service worker scope to ‘/en/’, and for ‘your-site.com/de’, change service worker path to ‘/de/sw.js’ and service worker scope to ‘/de/’.
Sometimes when there is no possibility to add more than one worker, you can try importing subdomains’ service workers into main service worker and write logic to use them conditionally.