-
To retrieve subscription status you can use
Notimatica.isSubscribed()
method insideready
event callback.<span id="status"></span>
Notimatica.push(['on', 'ready', function () { document.getElementById('status').textContent = Notimatica.isSubscribed() ? 'Subscribed' : 'Unsubscribed' }])
-
For this example we will use a
click
HTML event that will be triggered on link click.<a href="#" id="subscribe-link">Subscribe</a>
// Function to call on link click function subscribe (event) { e.preventDefault() Notimatica.push(['subscribe']) } // Define a callback on link click document.getElementById('subscribe-link').addEventListener('click', subscribe)
-
In this example we will use
subscribe:success
event to handle successful subscription.<a href="#" id="subscribe-link">Subscribe</a>
// Define a callback on link click var link = document.getElementById('subscribe-link') link.addEventListener('click', subscribe) // Function to call on link click function subscribe (event) { e.preventDefault() Notimatica.push(['subscribe']) } // Listening successful subscription event and hide the link Notimatica.push(['on', 'subscribe:success', function () { link.style.display = 'none' }])
-
Yes you can do it by setting
usePopup
option while initializing JavaScript SDK.var Notimatica = Notimatica || []; Notimatica.push(['init', { project: 'PROJECT_ID', subdomain: 'SUBDOMAIN', usePopup: true // Enables popup even if the site is under HTTPS }]);
-
JavaScript SDK lets you to overwrite default popup window size. You can do it by defining
popup
option while initializing JavaScript SDK.var Notimatica = Notimatica || []; Notimatica.push(['init', { project: 'PROJECT_ID', subdomain: 'SUBDOMAIN', popup: { height: 450, // Height of the popup in pixels width: 550 // Width of the popup in pixels } }]);
-
You can do it by setting
autoSubscribe
totrue
. On HTTPS websites, this instantly triggers browser's native opt-in prompt.var Notimatica = Notimatica || []; Notimatica.push(['init', { project: 'PROJECT_ID', subdomain: 'SUBDOMAIN', autoSubscribe: true }]);
-
Yes. You can do it like this:
var Notimatica = Notimatica || []; // First init Notimatica.push(['init', { project: 'PROJECT_ID', subdomain: 'SUBDOMAIN', autoSubscribe: true }]); // Reset SDK to initial state Notimatica.push(['resetSDK']); // Init it again but with different options Notimatica.push(['init', { project: 'PROJECT_ID', subdomain: 'SUBDOMAIN', autoSubscribe: false }]);
-
You can always emulate this process by setting
emulate
option. It can be useful if you want to test compatibility or our functionality before you connect to us.This option makes using Project ID optional so emulation process will be acting like your site is fully HTTPS. So there will be no popup windows.
var Notimatica = Notimatica || []; Notimatica.push(['init', { emulate: true }]);
-
Макс?
-
You can switch Notimatica’s SDK into debug-mode by adding
debug: true
parameter toinit()
. After that SDK will start to prints error messages on the Developer Tools Console:{.line-numbers}
var Notimatica = Notimatica || []; Notimatica.push(['init', { project: 'PROJECT_ID', subdomain: 'SUBDOMAIN', debug: true }]);
-
Notimatica supports tagging users. It is especially usefull to send notifications to a specific segments of audience. For example, only to registered users. You can assign up too 10 tags to each user.
To tag user you have to add
tags
option while initializing SDK.Here is an example:
{.line-numbers}
var Notimatica = Notimatica || []; Notimatica.push(['init', { project: 'PROJECT_ID', subdomain: 'SUBDOMAIN', tags: [ 123456789, 'registered' ] }]);
We've added 2 tags to the user. First one (on line #5) is some internal ID, second one is a role (
anonymous
,registered
or any other you like).This tags will be set to the user once he opt-ins to notifications.
Then in the Segments in Dashboard you can create a new "Registered" segment where all subscribers with
registered
tag will appear.
This segment can be used to send particular notifications to a registered users.