saveSettings: function saveSettings()

in js/lib/fbe.js [90:128]


  saveSettings: function saveSettings( pixelId, accessToken, externalBusinessId ){
    var _this = this;
    if(!pixelId){
      console.error('Meta Business Extension Error: got no pixel_id');
      return;
    }
    if(!accessToken){
      console.error('Meta Business Extension Error: got no access token');
      return;
    }
    if(!externalBusinessId){
      console.error('Meta Business Extension Error: got no external business id');
      return;
    }
    jQuery.ajax({
      type: 'post',
      url: window.facebookBusinessExtensionConfig.setSaveSettingsRoute,
      async : false,
      data: ajaxParam({
        pixelId: pixelId,
        accessToken: accessToken,
        externalBusinessId: externalBusinessId,
      }),
      success: function onSuccess(data, _textStatus, _jqXHR) {
        var response = data;
        let msg = '';
        if (response.success) {
          _this.setState({pixelId: pixelId});
          msg = "The Meta Pixel with ID: " + pixelId + " is now installed on your website.";
        } else {
          msg = "There was a problem saving the pixel. Please try again";
        }
        _this.consoleLog(msg);
      },
      error: function () {
        console.error('There was a problem saving the pixel with id', pixelId);
      }
    });
  },