-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpixel-options.txt
152 lines (144 loc) · 6.58 KB
/
pixel-options.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
In the above code, the user will be shown a "fake prompt" if you set the variable ``fakePrompt`` to ``true``. The text of the prompt will be derived from the fields in ``prompt``.
- There are several more parameters which you can tweak to set the behavior of the pixels. Here is a code snippet which uses all the allowed parameters::
-
- <script type="text/javascript">
- window.QGSettings = {
- "appId": "<your app id>",
- "push": {
- "popupAlignment": "center" or "top left" or "top right" or "bottom left" or "bottom right",
- "secondsBetweenPrompts": 3600,
- "delay": 1 ,
- "requestSelf": false,
- "fakePrompt": true,
- "prompt": {
- "title": "Fake prompt",
- "message": "Lorem opsem and so on"
- },
- "overlay": {
- "title": "Allow us to send you notifications",
- "message": "We will not send you spam notifications"
- },
- "thankYouPrompt": {
- "title": "Thanks for subscribing!",
- "message": "Happy Browsing",
- }
- },
- };
- </script>
-
-
-Some explanation is in order:
-
-*popupAlignment*
-Controls the alignment of the fake prompt, if it is requested. Default value is ``center``. Other possible values are ``top left``, ``top right``, ``bottom left``, ``bottom right``.
-
-*delay*:
-Controls how many seconds after the user has come on the website, do we show system prompt/fake prompt as applicable. Default value is 0.
-
-*secondsBetweenPrompts*:
-Controls the number of seconds between two fake prompts, in case the user declines the request for notification on the first fake prompt. Default value is 3600.
-
-*requestSelf*:
-If set to ``true``, the QGraph SDK does not show the system prompt or the fake prompt by itself. It is your code which decides when to do that. You can show the prompt any time by this code::
-
- qg("prompt-push")
-
-Note that if you use this parameter, *delay* and *secondsBetweenPrompts* are not considered.
-Default value is ``false``.
-
-*prompt*:
-Controls the content of the fake prompt, in case ``fakePrompt`` is ``true``.
-
-*overlay*:
Viveks-MacBook-Air:documentation vivekpandey$ git diff
diff --git a/integrating-web-sdk.rst b/integrating-web-sdk.rst
index 0f6228b..f311837 100644
--- a/integrating-web-sdk.rst
+++ b/integrating-web-sdk.rst
@@ -87,86 +87,25 @@ If your site is HTTPS
#. Download the following files
- #. https://s3-ap-southeast-1.amazonaws.com/qgraph-web-push/qg-service-worker.js
- #. https://s3-ap-southeast-1.amazonaws.com/qgraph-web-push/manifest.json
+ #. `https://s3-ap-southeast-1.amazonaws.com/qgraph/v3/<your_app_id>/qg-sw.<your_app_id>js`
+ #. `https://s3-ap-southeast-1.amazonaws.com/qgraph-web-push/manifest.json`
Copy above files to the root folder of your website. In case you want to use your GCM key, put your sender id in ``manifest.json`` above instead of the sender already present in the file. In this case you also need to enter your GCM key during the intergration. (We need this GCM key to send web push notifications)
Add the following lines inside of head or body tag::
- <script type="text/javascript">
- window.QGSettings = {
- "appId": "<your app id>",
- "push": {
- "fakePrompt": true,
- "prompt": {
- "title": "Get Latest Updates",
- "message": "Subscribe to notifications"
- }
- }
+ !function(q,g,r,a,p,h,js){
+ if(q.qg)return;
+ js = q.qg = function() {
+ js.callmethod ? js.callmethod.call(js, arguments) : js.queue.push(arguments);
};
- !function(q,g,r,a,p,h){if(q.qg)return;n=q.qg=function(){n.callmethod?n.callmethod.call(n,arguments):n.queue.push(arguments);};n.queue=[];p=g.createElement(r);p.async=!0;p.src=a;h=g.getElementsByTagName(r)[0];h.parentNode.insertBefore(p,h)}(window,document,'script','https://cdn.qgraph.io/dist/qgraph.v2.js');
- qg('init',window.QGSettings);
- </script>
+ js.queue = [];
+ p=g.createElement(r);p.async=!0;p.src=a;h=g.getElementsByTagName(r)[0];
+ h.parentNode.insertBefore(p,h)
+ }(window,document,'script','//cdn.qgraph.io/v3/<your_app_id>/qgraph.<your_app_id>.js');
In the above code, the user will be shown a "fake prompt" if you set the variable ``fakePrompt`` to ``true``. The text of the prompt will be derived from the fields in ``prompt``.
- There are several more parameters which you can tweak to set the behavior of the pixels. Here is a code snippet which uses all the allowed parameters::
-
- <script type="text/javascript">
- window.QGSettings = {
- "appId": "<your app id>",
- "push": {
- "popupAlignment": "center" or "top left" or "top right" or "bottom left" or "bottom right",
- "secondsBetweenPrompts": 3600,
- "delay": 1 ,
- "requestSelf": false,
- "fakePrompt": true,
- "prompt": {
- "title": "Fake prompt",
- "message": "Lorem opsem and so on"
- },
- "overlay": {
- "title": "Allow us to send you notifications",
- "message": "We will not send you spam notifications"
- },
- "thankYouPrompt": {
- "title": "Thanks for subscribing!",
- "message": "Happy Browsing",
- }
- },
- };
- </script>
-
-
-Some explanation is in order:
-
-*popupAlignment*
-Controls the alignment of the fake prompt, if it is requested. Default value is ``center``. Other possible values are ``top left``, ``top right``, ``bottom left``, ``bottom right``.
-
-*delay*:
-Controls how many seconds after the user has come on the website, do we show system prompt/fake prompt as applicable. Default value is 0.
-
-*secondsBetweenPrompts*:
-Controls the number of seconds between two fake prompts, in case the user declines the request for notification on the first fake prompt. Default value is 3600.
-
-*requestSelf*:
-If set to ``true``, the QGraph SDK does not show the system prompt or the fake prompt by itself. It is your code which decides when to do that. You can show the prompt any time by this code::
-
- qg("prompt-push")
-
-Note that if you use this parameter, *delay* and *secondsBetweenPrompts* are not considered.
-Default value is ``false``.
-
-*prompt*:
-Controls the content of the fake prompt, in case ``fakePrompt`` is ``true``.
-
-*overlay*:
-If set, an overlay will be shown while system prompt is displayed.
-
-*thankYouPrompt*::
-If set, a thank you message will be shown when the user grants permission for web push.
-