Install on WriteDocs

A WriteDocs site loads the scripts listed in the scripts field of writedocs.json on every page.

Copy your script address

In the portal, open Settings → Install and copy the address in the HTML line: https://analytics.writechoice.io/s/YOUR_SITE_KEY.js, with your own site key.

Add it to writedocs.json

Add it under scripts.body (scripts that load at the end of the page). If writedocs.json already has a scripts field, add the entry to its body list:

{
  "scripts": {
    "body": [
      { "src": "https://analytics.writechoice.io/s/YOUR_SITE_KEY.js" }
    ]
  }
}

Publish

Commit and push (or publish from the WriteDocs editor). Then check that it works.

Notes

  • WriteDocs sites are single-page applications: the script records a pageview on each navigation, with nothing else to set up.

  • The search box of WriteDocs sites is recorded automatically. See Site search.

  • To add a tag (for a version or a language), load the script with content instead of src, so it can carry the data-tag attribute:

    {
      "scripts": {
        "body": [
          { "content": "(function () { var s = document.createElement('script'); s.defer = true; s.src = 'https://analytics.writechoice.io/s/YOUR_SITE_KEY.js'; s.setAttribute('data-tag', 'v2'); document.head.appendChild(s); })();" }
        ]
      }
    }
  • If the site asks readers for consent before analytics load (WriteDocs’ consent banner), add "consent": true to the entry: the script then waits for the reader’s answer.

Heatmap preview

WriteDocs sites can be shown inside the portal, so the Heatmaps tab draws the clicks over the live page. Nothing to do.