Skip to content

Documentation

Widget and user identity

The widget is part of the tracking script. On the website, it is shown as a button at the edge of the screen. The visitor selects the message type, writes the text and sends it. The page, device and visit source are attached to the message.

Switching it on and appearance

  1. Install the tracking script. The widget needs no other code.
  2. In the site settings, switch on the Widget component.
  3. Set the color of the button and of the text, the position on the left or right and the button label.

Message types

TypeValue in the API
Not workingbroken
Something is missingmissing
I have an ideaidea
Praisepraise

Email and screenshot

  • Email for a reply is switched off by default. Switch it on only if you want to reply to messages. Both the email and the free text of the message are personal data and belong in the information about processing on your website.
  • A screenshot is attached only when the visitor allows it and only when you allow it in the widget settings. PNG, JPEG or WebP up to 1,500 kB is accepted.

From one IP address, the widget accepts at most 10 messages per hour for one site.

Identity of the signed-in user

When your website knows the signed-in user, it can send the user identifier with the message. A value from the browser can be forged, so your backend must sign it with the secret of the site. Lunaboard discards an unsigned or incorrectly signed identifier and stores the message without it.

1. Sign the identifier on the server

The signature is the HMAC-SHA256 of the identifier with the secret of the site, written in hexadecimal. You find the secret in the site settings, next to the widget. It belongs only on the server.

PHP
<?php // Na serveru: tajemství webu nikdy neposílejte do prohlížeče. $id = (string) $user->id; $signature = hash_hmac('sha256', $id, getenv('LUNA_IDENTITY_SECRET'));

2. Pass the identifier and the signature to the widget

HTML
<script> window.luna = window.luna || []; luna.push(['identify', '<?= $id ?>', '<?= $signature ?>']); </script>

Identity works the same way in the API: the fields user and user_signature for feedback and errors. When you generate a new secret in the settings, previously issued signatures stop being valid.

Feedback from your own form

You can also send a message from your own backend, for example from a contact form. The procedure is in the section API for the backend. You can have new messages sent to you by webhook.