Customizing URL Parameters

The URL-Based Installation works great for clean and structured URLs, but if your site uses query parameters (e.g., ?p=123 or ?utm_source=xyz), you can customize how they affect the unique instance creation. This page explains the available parameters, when to use them, and provides examples.

🚧

Note

This is an advanced customization method for URL-Based Installation method only. If you choose to use ID-Based Installation, all of these configurations will be ignored.

Defining query parameters behavior

The data-url-params attribute defines how query parameters are included in the widget's unique instance creation. It is placed inside the <div> element of the widget and affects how the query string contributes to its unique identifier.

Example

Here’s a sample snippet showing how data-url-params and related attributes should be structured:

<div class="arena-comments-widget" 
     data-site-slug="[YOUR-SITE-SLUG]" 
     data-url-params="[option]" 
     data-accepted-params="[comma-separated-values]" 
     data-rejected-params="[comma-separated-values]"></div>
  • Replace [YOUR-SITE-SLUG] with your actual site slug.
  • Replace [option] with one of the values: allow-all-params, only-accept-params, or only-reject-params.
  • Use data-accepted-params only if only-accept-params is set.
  • Use data-rejected-params only if only-reject-params is set.

data-url-params options

Here’s a table of the parameters you can add to the <div> element to control query parameter behavior:

ParameterDescription
allow-all-paramsIncludes all query parameters in the widgetId.
only-accept-paramsIncludes only the parameters listed in data-accepted-params.
only-reject-paramsIncludes all parameters except those listed in data-rejected-params.

When to Use Each Option

  • allow-all-params: Use when all query parameters are part of your page’s identity (e.g., tracking or IDs).
  • only-accept-params: Use when specific parameters (like p for post ID) define the page, ignoring others.
  • only-reject-params: Use when you want most parameters included but need to exclude specific ones (e.g., utm_source).

Examples

Example 1: allow-all-params

For a URL like https://[your-domain].com/?p=123&utm_source=newsletter:

<div class="arena-comments-widget" 
     data-site-slug="[YOUR-SITE-SLUG]" 
     data-url-params="allow-all-params"></div>

Result: The widgetId includes p=123 and utm_source=newsletter.

Example 2: only-accept-params

For the same URL, but only p=123 matters:

<div class="arena-comments-widget" 
     data-site-slug="[YOUR-SITE-SLUG]" 
     data-url-params="only-accept-params" 
     data-accepted-params="p"></div>

Result: The widgetId includes p=123 and ignores utm_source.

Example 3: only-reject-params

For the same URL, excluding utm_source:

<div class="arena-comments-widget" 
     data-site-slug="[YOUR-SITE-SLUG]" 
     data-url-params="only-reject-params" 
     data-rejected-params="utm_source"></div>

Result: The widgetId includes p=123 but excludes utm_source.


Questions

Reach out to [email protected] or join live support inside the dashboard.