Custom Notificator

Custom Notificator

HTML
<script>
  window.SOCIALPROOF_NOTIFICATOR = {
    isAvailable: function () {
      return true;
    },
    setStyleConfig: function (styleConfig) {},
    setTiming: function (timing) {},
    forEvent: function (event) {
      return event.name === 'buy';
    },
    notify: function (event, text, image, link, brandless, id) {
      // render the notification your own way
    }
  };
</script>

Trust Info notifications are rendered by Trustisto. If you want to render them in your own way, e.g. inside your page layout, define a custom notificator: an object in window.SOCIALPROOF_NOTIFICATOR. Trustisto still decides when a notification is shown and what it says; your notificator decides how it looks.

Define it before the initialization snippet.

  • isAvailable() - return true to use the custom notificator
  • setStyleConfig(styleConfig) - called once at start with the notification style set in the panel
  • setTiming(timing) - called once at start with the notification timing set in the panel
  • forEvent(event) - return true if the custom notificator should show the notification for this event; for false Trustisto shows its own notification
  • notify(event, text, image, link, brandless, id) - show the notification:
    • event - the event data
    • text - the notification message, as HTML
    • image - URL of the image, if any
    • link - URL the notification should link to, if any
    • brandless - true if the “by Trustisto” branding should be hidden
    • id - ID of the notification