{"_id":"57b9d33ee9cf700e00493441","__v":0,"githubsync":"","category":{"_id":"57b4705ee9e4c60e00f6f4c3","project":"56cecbdb44c5700b0095c03a","__v":0,"version":"56cecbdc44c5700b0095c03d","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-08-17T14:10:38.587Z","from_sync":false,"order":5,"slug":"web","title":"Website"},"project":"56cecbdb44c5700b0095c03a","user":"56cecbb2e50c9c1b008303eb","version":{"_id":"56cecbdc44c5700b0095c03d","project":"56cecbdb44c5700b0095c03a","__v":10,"createdAt":"2016-02-25T09:39:40.121Z","releaseDate":"2016-02-25T09:39:40.121Z","categories":["56cecbdc44c5700b0095c03e","56d1d2c05ad7ad0b00b7e809","56d1d2fa5ad7ad0b00b7e80a","56d369331660770b00081159","56d3693d1660770b0008115a","56e5361e7990160e002e3fbc","56e5362775eb791700a9c4d2","57a9030947f2f419009188d4","57b4705ee9e4c60e00f6f4c3","5828f5b04774ab0f005179a2"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-08-21T16:13:50.752Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":3,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"1. Configure the Chrome Web Notifications in PushApps\"\n}\n[/block]\nUnder the selected app, go to the Settings tab and scroll down for the Chrome Web Notifications settings:\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/f7c86b6-Screen_Shot_2016-08-21_at_6.17.30_PM.png\",\n        \"Screen Shot 2016-08-21 at 6.17.30 PM.png\",\n        810,\n        294,\n        \"#e8eaec\"\n      ]\n    }\n  ]\n}\n[/block]\n* If you don't know how to get your GCM API Key and Project Number, [please check our specific guide about it](doc:chrome-configuration).\n\n* Your full site url including `http://`.\n\n* Please notice that because your website does not use `https` protocol, you'll be ask to select a subdomain, which will create a unique URL for you in the form of `https://your_sub_domain.pushapps.mobi`. That way, you'll be able to send notifications even though your website does not use SSL.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"2. Install the SDK\"\n}\n[/block]\n2.1 Include the PushApps SDK from our CDN:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<script src=\\\"https://code.pushapps.mobi/pushapps-sdk.js\\\" async></script>\",\n      \"language\": \"html\"\n    }\n  ]\n}\n[/block]\n2.2 Initialize the SDK with the following code:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<script>\\n      var PushApps = window.PushApps || [];\\n      PushApps.push([\\\"init\\\", {\\n          sdkKey: \\\"Your_SDK_Key\\\",\\n          subdomain: \\\"Your_Selected_Subdomain\\\",\\n          autoRegister: false /* when working with non-SSL site, we recommend to leave it as false, otherwise the browser may block our registration popup */\\n      }]);\\n  </script>\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n2.3. Subscribe to notifications - Our non-SSL structure is based on a registration popup. In order for the browser to not block our popup, please call the following method AFTER some user interaction (e.g. button click) and not automatically:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"PushApps.registerForPushNotification();\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"success\",\n  \"title\": \"That's it!\",\n  \"body\": \"You're ready to go live! Users will start register now to push notifications and you can start interact with them immediately!\"\n}\n[/block]","excerpt":"","slug":"sdk-installation-http-1","type":"basic","title":"SDK Installation (HTTP)"}

SDK Installation (HTTP)


[block:api-header] { "type": "basic", "title": "1. Configure the Chrome Web Notifications in PushApps" } [/block] Under the selected app, go to the Settings tab and scroll down for the Chrome Web Notifications settings: [block:image] { "images": [ { "image": [ "https://files.readme.io/f7c86b6-Screen_Shot_2016-08-21_at_6.17.30_PM.png", "Screen Shot 2016-08-21 at 6.17.30 PM.png", 810, 294, "#e8eaec" ] } ] } [/block] * If you don't know how to get your GCM API Key and Project Number, [please check our specific guide about it](doc:chrome-configuration). * Your full site url including `http://`. * Please notice that because your website does not use `https` protocol, you'll be ask to select a subdomain, which will create a unique URL for you in the form of `https://your_sub_domain.pushapps.mobi`. That way, you'll be able to send notifications even though your website does not use SSL. [block:api-header] { "type": "basic", "title": "2. Install the SDK" } [/block] 2.1 Include the PushApps SDK from our CDN: [block:code] { "codes": [ { "code": "<script src=\"https://code.pushapps.mobi/pushapps-sdk.js\" async></script>", "language": "html" } ] } [/block] 2.2 Initialize the SDK with the following code: [block:code] { "codes": [ { "code": "<script>\n var PushApps = window.PushApps || [];\n PushApps.push([\"init\", {\n sdkKey: \"Your_SDK_Key\",\n subdomain: \"Your_Selected_Subdomain\",\n autoRegister: false /* when working with non-SSL site, we recommend to leave it as false, otherwise the browser may block our registration popup */\n }]);\n </script>", "language": "javascript" } ] } [/block] 2.3. Subscribe to notifications - Our non-SSL structure is based on a registration popup. In order for the browser to not block our popup, please call the following method AFTER some user interaction (e.g. button click) and not automatically: [block:code] { "codes": [ { "code": "PushApps.registerForPushNotification();", "language": "javascript" } ] } [/block] [block:callout] { "type": "success", "title": "That's it!", "body": "You're ready to go live! Users will start register now to push notifications and you can start interact with them immediately!" } [/block]