Подписаться

Website SDK HTTP Installation

Gravitec SDK Installation for Chrome websites (desktop + mobile)

HTTP vs. HTTPS

This is the guide for using Google Chrome push notifications on websites that have some pages served via HTTP instead of HTTPS.

If you are sure that each page is served only via HTTPS, then you should follow [this guide] (Website-SDK-HTTPS-Installation.md)

Requirements

W3C Web Push Notifications are currently only supported by Chrome 42+

  • Includes Chrome for Windows, Mac OS X, Linux, Chrome OS and Android. Chrome for iOS is not yet supported by Google.

1. Include Required GravitecSDK.js

1.1 Include https://cdn.gravitec.net/storage/APP_KEY/client.js in the the <head> HTML tag of each of your website pages. Update APP_KEY with your Gravitec AppId. The best way is to add it to the code that generates the layout for each of your webpages. The resulting HTML should look like this:

<head>
    <script src="https://cdn.gravitec.net/storage/c98ddb5b4e54032b1f012127a3c5aec3/client.js/" async> </script>
</head>

2. Customize Gravitec (Optional)

2.1 Init with your custom button or event.

Call Gravitec.push(["init"]) from a javascript file that is included in every page. Create or use your button and update YOUR_CUSTOM_BUTTON_ID with your button id.

var Gravitec = Gravitec || [];
Gravitec.push(["init", {"autoRegister":false}]);

window.onload = function() {
    //Replace YOUR_CUSTOM_BUTTON_ID with your button id
    document.getElementById("YOUR_CUSTOM_BUTTON_ID").onclick = registerPush;

    function registerPush() {
        Gravitec.push(["registerHttp");
    }
}

That's It!

That’s it for now - the setup is complete. See our Web SDK API for more functions.

0 Комментарии

Статья закрыта для комментариев.
На базе технологии Zendesk