Universal Embed Code

Disqus can be installed on virtually any website using the universal JavaScript embed code. The following documentation is meant for developers only. Disqus also provides installation instructions for dozens of popular blogging and website platforms such as WordPress, Blogger, and more.

Before you start

  • Make sure you've registered your website with Disqus. Read the Quickstart Guide for more information.
  • You will need to be able to edit the HTML of the website you are installing Disqus on.
  • To install Disqus, you will need to know your forum shortname as registered on Disqus.

Embed code

This is the JavaScript embed code which loads and displays Disqus on your site, typically on the individual article or post pages. The disqus_thread ID is where the postbox is loaded, so make sure to include it above the embed script as shown below.

Note: Don't forget to change EXAMPLE to your forum's shortname.

<div id="disqus_thread"></div>
<script>
    /**
     *  RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
     *  LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables
     */
    /*
    var disqus_config = function () {
        this.page.url = PAGE_URL;  // Replace PAGE_URL with your page's canonical URL variable
        this.page.identifier = PAGE_IDENTIFIER; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
    };
    */
    (function() {  // REQUIRED CONFIGURATION VARIABLE: EDIT THE SHORTNAME BELOW
        var d = document, s = d.createElement('script');
        
        s.src = '//EXAMPLE.disqus.com/embed.js';  // IMPORTANT: Replace EXAMPLE with your forum shortname!
        
        s.setAttribute('data-timestamp', +new Date());
        (d.head || d.body).appendChild(s);
    })();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>

Configuration variables

Within the above embed code, there are configuration variables which tell Disqus how the system should work and behave.

EXAMPLE is your "shortname" and should be replaced to tell Disqus which website account (called a forum on Disqus) this system belongs to.

this.page.url tells Disqus how to uniquely identify the current page.

this.page.identifier tells Disqus the location of the page for permalinking purposes.

There are many more configuration variables available, but these are the most important. To learn more about these and the other configuration variables, read JavaScript configuration variables.

Comment Counts

Easy Installation

Some platforms also provide simple steps for installation that do not require any javascript coding. These integrations can be found on our installation page
Installation Options
Ask the Community Contact us

Still need help? Discuss Disqus is our most active place for getting quick help, sharing feedback, and discussing issues with others – a knowledgeable and helpful support team and community are there right now. Our 101 post is the best place to get started.

Make sure to search our Knowledge Base first... your answer might be just a click away!