Can I place Push files in custom folder?

By default we ask website owners to copy Push files to their main (root) folder, so that are available from:

How to place these files in custom folder?

For example, if you would like to place files in folder or any different subfolder that is possible as well. In this case then you need to follow these instructions:

1. Upload files to server.

Copy the 3 files to your /media/ folder (or change /media/ to the folder you would like to use). So that they would be available from:

2. Update the MaxTraffic tracking code.

If your website ID = 1234, then your tracking code by default would look like:
<script>||function(){(mt.q=mt.q||[]).push(arguments)};mt.l=+new Date;
  mt('create', 1234);
<script async src='//'></script>

Please replace it with following tracking code:

<script>||function(){(mt.q=mt.q||[]).push(arguments)};mt.l=+new Date;
  mt('create', 1234, {
        worker: '/media/sw-mt.js',
        manifest: '/media/manifest.json',
<script async src='//'></script>

Don't forget to adjust the tracking code to your website:

  • Replace 1234 with your website ID
  • Replace /media/ with the folder that you will use

3. Add custom header

Ask your IT team to make sure, that service worker file (sw-mt.js) has this header:
Service-Worker-Allowed: /
If that is not the case - then your website server software (probably Apache or nginx) needs to be configured so that when visitors browser requests this file, then this specific header is used.