◾Front-end integration
This setup should be done in order to enable popups, gamification, web-push, and tracking of the online status of players.
1. Installing the Smartico script
Smartico javascript library should be plugged on all front-end pages of your site(s)
Your label key: to be provided by the Customer Success Manager
Your brand key: to be provided by your Customer Success Manager
Your location of the smartico script: to be provided by your Customer Success Manager
Please note: if you have a production and testing environment, you should have separate keys for label and brand. Ensure you never use production keys in a testing environment and vice versa.
2. Identifying the user
On every page, when you have a user identified, you should set user_id and language of user in the global variables
_smartico_user_id - should be user id as it's known in your system. It should be the same ID of the user as will be used in server-to-server integration
_smartico_language - is ISO 639-1 code of user language (2 symbols code). If you need to support languages with regional codes like "pt-br", please consult with Smartico team for the proper mappings to 2-symbols codes.
Whenever the user is logged out, set these variables to null or delete from the global scope, e.g.:
Note: you can use additional protection from faking the user_id, you can see more details here
3. Preparation for Web-push notifications
The following file should be put in the root of the web/mobile sites. They are needed for the Web Push notifications.
https://libs.smartico.ai/smartico-messaging-sw-v2.js
e.g. if your site is somesite.com, then the file should be located as
https://somesite.com/smartico-messaging-sw-v2.js
4. Triggering gamification widget
When the gamification setup is ready and tested, you can put the entry point to open the gamification widget in the following way.
The main case when it’s needed from the Partner site is to provide an entry point to open Gamification UI. Example:
Note: in the initial setup, the gamification widget will be empty, and you can only test the fact of opening the widget. As soon as the data integration is done, trainings for CRM team are completed, and CRM team setup gamification elements, you will be able to see real content in the widget.
5. Validating setup
When you complete steps 1,2 and 3, you should be able to see the following messages in the console log of the browser
After executing _smartico.requestPushPermissions() command in the console, you should see
If there are any issues identified during setup, you will get explanations about nature of issue and needed actions
Last updated