Subscription settings
After creating a service, you need to activate the push subscription form on your site so visitors can subscribe to receive push notifications.
Go to Najva panel > Menu > Contact management > Subscription form (پنل نجوا > منو > مدیریت مخاطبان > فرم عضوگیری) and click Create your first subscription form (ایجاد اولین فرم عضوگیری). Creating a form has four steps: 1. Select service (1. انتخاب سرویس) → 2. Service worker (2. سرویس ورکر) → 3. Design (3. دیزاین) → 4. Performance settings (4. تنظیمات عملکرد)
Prerequisite: install the script service
Section titled “Prerequisite: install the script service”If you have not done so yet, first create a service by following the guide to creating a service (Najva script).
Step 1: Select service
Section titled “Step 1: Select service”- Select your address (آدرس موردنظر خود را انتخاب کنید) — from the domains you created in the Service section.
- Select the service (سرویس را انتخاب کنید) — currently only Push notification (پوش نوتیفیکیشن) is active, and the other services are disabled and labeled “Coming soon” (به زودی).
- Click Next step (مرحله بعد).
Step 2: Service worker
Section titled “Step 2: Service worker”A service worker is a JavaScript file that runs in the background of your users’ browsers and makes it possible to send push notifications, cache data and support offline operation. By placing this file on your host, users receive notifications even when your site is not open.
- Click Download service worker file (دانلود فایل سرویسورکر).
- Upload the file to the root of your site so that it is accessible at this address (replace
yourdomain.irwith your own domain):https://yourdomain.ir/najva-messaging-sw.js - Click the Check (بررسی) button so Najva can verify the installation.
If everything is correct, you see the message “The service worker has been placed correctly” (سرویسورکر به درستی قرار داده شده است).
If you see the message “Your service worker has not been placed correctly” (سرویسورکر شما به درستی قرار نگرفتهاست), check two things: that the file is really in the root of your site, and that you are using the latest version of the Najva service worker. An old file can also cause this error.
Step 3: Design
Section titled “Step 3: Design”In this step you can create a two-step subscription form: before the browser shows its own permission window, the user is shown a form with the text and look you choose. This usually raises the acceptance rate, because the user first understands, in your own language, what they are about to receive.
This step is optional. If you do not need a two-step form, go straight to the next step.
To create the form, first turn on Enable form (فعالسازی فرم) and then configure these settings:
| Section | Settings |
|---|---|
| Form position (موقعیت فرم) | Where the form is placed, in 9 positions: top left, top center, top right, middle left, center of the page, middle right, bottom left, bottom center, bottom right |
| Background (پسزمینه) | Background color, form width (pixels), form height (pixels), enable outer background (Overlay) and its color |
| Title (عنوان) | Title text, title color, title size (pixels) |
| Text (متن) | Description text, text color, text size (pixels) |
| Button (دکمه) | Button text, button color, button text color, button size, button width, button height |
| Image (تصویر) | Enable image, image position (left, right, top, bottom), select image, image width and height |
By default the panel shows a ready-made sample: the title “Stay up to date!” (به روز بمانید!), the description “Would you like to hear the latest news?” (آیا میخواهید از آخرین اخبار مطلع شوید؟) and the button “Sure” (حتما). You can replace all three with your own text.
When you are finished, click Save form settings (ذخیره تنظیمات فرم) or Save and next step (ذخیره و مرحله بعد).
Step 4: Performance settings
Section titled “Step 4: Performance settings”In this step, you use “triggers” to decide when the subscription form is shown to the user:
- Based on time (بر اساس زمان) — after how long (in seconds) should the request be shown to the user?
- Based on scroll (بر اساس اسکرول) — after what percentage of scrolling should the request be shown to the user?
- Based on visits (بر اساس بازدید) — after how many visits should the request be shown to the user?
Click Confirm (تأیید). After that, the message “🎉 Congratulations! The push notification service was activated successfully.” (🎉 تبریک! سرویس پوش نوتیفیکیشن با موفقیت فعال شد.) is displayed, and from then on new contacts subscribe automatically through your site.
Managing subscription forms
Section titled “Managing subscription forms”- You can create other subscription forms in the same way.
- All created forms can be viewed and managed in one list.
- Add a new form with the New subscription form (فرم عضوگیری جدید) button.
- With the three-dot icon (⋮) next to each form, you can edit or delete it.
- For the push service on each address, you can create only one subscription form.
Notes about how the subscription request is shown
Section titled “Notes about how the subscription request is shown”- The text of the browser’s own permission window cannot be edited, and it changes based on the browser language. The only text under your control is the two-step form from the Design step.
- Subscription is recorded based on your site’s main domain; if the user has already subscribed on the same domain or rejected the request, it is not shown to them again.
- Where the request appears on mobile depends on the browser (for example, the middle of the page in Chrome, the bottom of the page in Samsung Internet) and is outside Najva’s control.
For more questions, see the push notification FAQ.
Next step
Section titled “Next step”To view and manage the contacts who have subscribed, see Grouping push contacts.