Logora
English

Our Universal code

Learn how to manually install Logora on your site using the Universal Embed Code.

Laura
Written by LauraLast update 3 years ago

Universal code


Learn how to manually install Logora on your site using the Universal Embed Code.


Logora can be installed on virtually any website using the universal JavaScript embed code. 

The following documentation is meant for developers only. Logora also provides installation instructions for WordPress.


Logora’s javascript installation is a two-step process : 


  1. Insert the debate synthesis 
  2. Insert the debate space

Before your start


  1. Make sure you've registered your website with Logora on the onboarding. 
  2. You will need to be able to edit the HTML of the website you are installing Logora on.
  3. To install Logora, you will need to know your application name, available on your administration panel in Parameters > General .
  4. Authorize the domains where you insert Logora. You have to access the administration panel in the Parameter > General > Security > Domains.
    As an example, if the code is inserted on a page such as https://example.com/article/example-article, add the domain  https://example.com (wqrning : don’t add the «/«   at the end)
    Examples : http://localhost:3000 , http://sub-domain.example.com.  Important : adding a domain on the administration panel works as adding a tag, don’t forget to click « enter » when adding Urls. 

1. Install the debate synthesis 


Insert the Javascript code where you wish to see the synthesis in your article template. This is a Javascript code example, loading and displaying the debate synthesis linked to the article. 


The container logora_synthese is where the synthesis is loaded. 


Code to copy/paste and replace with your configuration variables : 


<div class="logora_synthese" data-object-id="logora_config"></div>
<script>
    // Configuration variables
    var logora_config = {
        shortname: "NOM_APPLICATION", // Application name available in your administration panel 
        debate: {
            identifier: "DEBATE_IDENTIFIER" // Your debate identifier 
        }
    };


    (function() {
        var d = document, s = d.createElement('script');
        s.src = 'https://api.logora.fr/synthese.js'; 
        (d.head || d.body).appendChild(s);
    })();
</script>


Configurations variables


shortname (mandatory) : application name given by Logora in your administration panel, Tab Parameters > General


debate.identifier (mandatory) : the unique identifier linked to your page. This identifier must be unique for each page where the synthesis is inserted.

It is mandatory to get the debate to the relevant page. For example, the identifier can be the article's ID found in your database, or a unique slug ('exemple-identifiant').


The debate linked to the page must be created from your administration panel, by filling the field debate.identifier. If there isn't any debate linked to the identifier, the synthesis won't be displayed. 


Debates can also be created automatically when loading the synthesis, from configurations variables, without going through the administration panel. Read How to create debates automatically from the synthesis ?


2. Install the debate space 

Unlike the synthesis, the debate space is inserted in a dedicated page. Let's take the example of a website available at https://exemple.com.
The website owner want to access the debate space at https://exemple.com/espace-debat.
Here are the steps to follow :

 

1. Add a page to insert the debate space 


Create a dedicated page where the debate space will be displayed. This page is available at https://exemple.com/espace-debat.
The prefix 'espace-debat' is by default . You can edit the prefix from your administration panel. 


2. Insert the Javascript code and your configuration variables 


Insert the Javascript code where you want to display the debate space.
The ID logora_app is where the debate space is loaded. 


Code to copy/paste and replace with your configuration variables : 


<div id="logora_app"></div>
<script>
    // Variables de configuration
    var logora_config = {
        shortname: "APPLICATION_NAME" // Application name found in your administration panel 
    };

    (function() {
        var d = document, s = d.createElement('script');
        s.src = 'https://api.logora.fr/debat.js';
        (d.head || d.body).appendChild(s);
    })();
</script>


Configurations variables


shortname (mandatory) : application name given by Logora in your administration panel, Tab Parameters > General


Configurations variables are also mandatory to personalize the debate space. Read the article Javascripts configurations variables for more informations. 


You'll observe the navigation bar and the Logora footer, separated by a blank space.


 3. Routing the debate space by rewriting your engine


Rewrite engine on your website or CMS so that all routes beginning with 'espace-debat/' (or the prefix you have chosen)  leads to the page where the debate space is embedded. 


Go to https://exemple.com/espace-debat/debats. You are on the debate space homepage ! 


To edit the prefix and rewrite your engine, read this article : What are the debate space routes ?


You now have to implement the login & personalize Logora before launching your first debate !

Follow this steps to complete the installation :

- Single Sign-On

- Personalize Logora 

- Launch your first debate


Did this answer your question?