Opt-in dialog's text customization lost

issue
web

#1

Hello,

We have integrated the following tag:

(function(w, d, s, id, n){
    w[n] = w[n] || {q: [],
        init: function(o) {w[n].initOpts = o;},
        ready: function(c) {w[n].q.push(c);}};
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) {return;}
    js = d.createElement(s); js.id = id;
    js.src = "https://cdn.by.wonderpush.com/sdk/1.1/wonderpush-loader.min.js";
    fjs.parentNode.insertBefore(js, fjs);
}(window, document, "script", "wonderpush-jssdk-loader", "WonderPush"));

WonderPush.init({
    webKey: "MY_WEKBEY",
    optInOptions: {
        // Vous pouvez modifier ou traduire les chaînes suivantes :

        externalBoxMessage: "Nous aimerions vous envoyer des notifications",
        externalBoxExampleTitle: "Notification exemple",
        externalBoxExampleMessage: "Ceci est un exemple de notification",
        externalBoxDisclaimer: "Vous pouvez vous désinscrire à n'importe quel moment.",
        externalBoxProcessingMessage: "Inscription en cours...",
        externalBoxSuccessMessage: "Merci de vous être inscrit !",
        externalBoxFailureMessage: "Désolé, un problème est survenu.",
        externalBoxTooLongHint: "Mauvaise connexion ou navigation privée ?",
        externalBoxCloseHint: "Fermer",
        modalBoxMessage: "Recevez d&eacute;sormais nos news en temps r&eacute;el.<br/>Vous pouvez vous d&eacute;sinscrire &agrave; n'importe quel moment.",
        modalBoxButton: "J'ai compris !"
    },
    plugins: {
    'optin-dialog': {
      triggers: {
        snooze: 604800000
      }
    }
  }
});

And the dialog now displays in English besides the configuration using French text in our dashboard.

How can I fix this?

Thanks!


#2

Hi,

When you include a plugin via the init options, it takes its options from there exclusively, and overrides any configuration you might have done in the dashboard. It is so to always keep options in a consistent state and to avoid hazardous merges.

So you will have to mention the text options in addition to the triggers you already mention.
Those options are listed in the plugin documentation.

Here is an example (keeping your trigger.snooze value):

'optin-dialog': {
  triggers: {
    snooze: 604800000,
  },
  title: "Voulez-vous recevoir nos nouvelles en temps réel ?",
  message: "Vous pouvez vous désinscrire à tout moment.",
  positiveButton: "S'inscrire",
  negativeButton: "Plus tard",
}

Best.


#3

Also note that any trigger configuration done from the dashboard, like the prompt trigger (immediately, after a few pages/visits, manually) are now controlled with the triggers you have provided.

By default it will trigger immediately.
See the WonderPush Web SDK triggers documentation for reference.

For instance, to trigger after a few pages, use minPages: 5, so that triggers becomes:

triggers: {
  minPages: 5,
  snooze: 604800000,
}

Best