Google Tag Manager Installation

Add Simple Commenter to your website using Google Tag Manager (GTM). This method uses the data attribute loading mode since GTM can modify query parameters in script URLs.

GTM sometimes strips or modifies URL query parameters. Using data-domain instead of a query parameter ensures your domain is always passed correctly.

Prerequisites

  • A Google Tag Manager account
  • GTM container installed on your website
  • Your Simple Commenter domain from the dashboard

Step-by-Step Installation

1. Open Google Tag Manager

Go to tagmanager.google.com and select your container.

2. Create a New Tag

  1. Click Tags in the left sidebar
  2. Click New to create a new tag
  3. Name it "Simple Commenter Widget"

3. Configure the Tag

  1. Click Tag Configuration
  2. Select Custom HTML
  3. Paste this code:
<script
  src="https://simplecommenter.com/js/comments.min.js"
  data-domain="your-domain.com"
  defer
></script>

Replace your-domain.com with your actual domain from the Simple Commenter dashboard.

4. Set the Trigger

  1. Click Triggering
  2. Select All Pages (or choose specific pages)
  3. Click Save

5. Publish

  1. Click Submit in the top right
  2. Add a version name (e.g., "Added Simple Commenter")
  3. Click Publish

Alternative: Function Call Method

If the script still doesn't load, use the function call method which dynamically injects the script:

<script type="text/javascript">
  (function(k,s) {
    s=document.createElement('script');
    s.async=true;
    s.src="https://simplecommenter.com/js/comments.min.js";
    s.dataset.domain=k;
    document.head.appendChild(s);
  })('your-domain.com')
</script>

Using GTM Variables

You can use GTM variables to make the domain dynamic:

<script
  src="https://simplecommenter.com/js/comments.min.js"
  data-domain="{{Page Hostname}}"
  defer
></script>

This uses GTM's built-in Page Hostname variable, which automatically uses the current page's hostname.

Verifying Installation

  1. Use GTM's Preview mode to test before publishing
  2. Open your website and check for the feedback widget
  3. Open Developer Tools (F12) and verify the script loaded in the Network tab
  4. Check the Console for any errors

Troubleshooting

Widget not appearing

  • Ensure the GTM container is properly installed on your site
  • Check that the tag is firing (use GTM Preview mode)
  • Verify the domain matches your dashboard settings exactly
  • Try the function call method above

Tag fires but widget doesn't load

  • Check for Content Security Policy errors in the browser console
  • Ensure no other scripts are conflicting
  • Try triggering on DOM Ready instead of All Pages

Multiple widgets appearing

  • Check you don't have the script added both via GTM and directly in your HTML
  • Ensure the tag only fires once per page

Advanced: Conditional Loading

Load the widget only on specific pages using GTM triggers:

Example: Only on blog pages

  1. Create a new trigger
  2. Set type to Page View
  3. Add condition: Page Path contains /blog/
  4. Use this trigger for your Simple Commenter tag

Need help? Contact support.

Was this page helpful?