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.
NoteThis 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, oronly-reject-params. - Use
data-accepted-paramsonly ifonly-accept-paramsis set. - Use
data-rejected-paramsonly ifonly-reject-paramsis set.
data-url-params options
data-url-params optionsHere’s a table of the parameters you can add to the <div> element to control query parameter behavior:
| Parameter | Description |
|---|---|
| allow-all-params | Includes all query parameters in the widgetId. |
| only-accept-params | Includes only the parameters listed in data-accepted-params. |
| only-reject-params | Includes 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
pfor 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
allow-all-paramsFor 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
only-accept-paramsFor 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
only-reject-paramsFor 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.
QuestionsReach out to [email protected] or join live support inside the dashboard.
Updated 6 months ago