> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.trustmary.com/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# Using parameters to filter reviews into your widget


# Quick steps for using the multi-location widget

1. Set unique shortnames for your [Review Connections](https://app.trustmary.com/review/import). Use something short but descriptive.
2. Add the [segment parameter "m"](#1-segment-parameter-m) to your widget's embed code after the ID string. Use the value you set before.
3. Embed the widget with the added parameter, and it should display reviews only from the specified segment.


# The multi-location widget

When embedding a widget on a webpage it is possible to give additional parameters that alter the widget appearance & content. This makes it possible to reuse the **same** widget to display a different set of reviews with a different title.

Reusing the widget will reduce manual work when embedding widgets on multiple pages to **show reviews for different products or locations**. New reviews will also automatically be updated to the widgets according to the parameters given to it.

The filter parameters are simply appended **after the widget ID** in the script embed's URL or in the **data-trustmary-widget** attribute in the alternative <div> embed method. See examples for this below.

The parameter values have to be encoded in case they contain special characters.

# Step-by-step instructions for non-coders

| Have more than a dozen review connections or locations? You might want to consider using our [API](https://help.trustmary.com/en/article/connect-to-trustmary-with-our-api-uk2akd/) for managing review connections to automate the process for you.

1. Add review connections (Google, Booking.com, TripAdvisor, etc.) on the **Review Connections** page.

![](https://storage.crisp.chat/users/helpdesk/website/-/b/8/0/8/b8083cc0c8b32000/nayttokuva-2025-11-10-kello-14_x2fz09.png =600x262)
1. Find the **Advanced settings** of your connection and click the arrow to open it. Give each review connection a unique name in the **Short name** section.

![](https://storage.crisp.chat/users/helpdesk/website/b8083cc0c8b32000/reviewconnectionssourceshortna_1b1sosd.png)
3. Create a widget (or open an existing one).

![](https://storage.crisp.chat/users/helpdesk/website/-/b/8/0/8/b8083cc0c8b32000/nayttokuva-2025-11-10-kello-14_io9lfj.png =900x199)
4. Click the **Add to website** button in the widget editor, and copy the embed code. Insert **?connection=[short-name]** into the code after the widget ID.

![](https://storage.crisp.chat/users/helpdesk/website/-/b/8/0/8/b8083cc0c8b32000/widgetseditoraddtowebsitedialo_n44rfh.png =600x465)
In this example, the short names are called **mono-sushi** and **nanapo-sushi**, so the codes would look like this:

```
<script src="https://widget.trustmary.com/Uh_MrCSI1?connection=mono-sushi"></script>

<script src="https://widget.trustmary.com/Uh_MrCSI1?connection=nanapo-sushi"></script>
```

5. Open your website editor and **paste the code with the added short name** onto a page.

![](https://storage.crisp.chat/users/helpdesk/website/15d3efd28a5be900/584de6b6-5aa7-4471-b5ba-89112a_156wtvn.png)

### Case example: Sushi Helsinki

Currently, Sushi Helsinki has

* Dozens of sushi restaurants with unique landing pages
* Imported Google reviews for each location and given them unique short names
* One widget was added to multiple landing pages and filtered with review connections

###### Mono-sushi

![](https://storage.crisp.chat/users/helpdesk/website/cc6d3680e74b1800/d1619910-3473-4baf-9dd0-e9d69a_1txtw4f.png)

###### Nanapo Sushi

![](https://storage.crisp.chat/users/helpdesk/website/7ecf953eeeff3400/6cb90b48-17e0-4a3e-ad36-671cd2_1fin3pa.png)

If the appearance of the widgets needs to be chaged, **all changes can be done to a single widget** in Trustmary. Once the changes are saved in the widget editor, all of the widget instances will automatically be updated without touching the code again.

# Changing the widget content

It is possible to change the title of the widget and the product name in Schema.org structured data for the widget by using parameters.

### Change widget title field

The widget title field used by some widget templates can be overridden with the **title** parameter. In script embeds the parameter is placed after the URL:

```javascript
<script src="https://widget.trustmary.com/<YOUR_WIDGET_ID>?title=A+title+for+this+location"></script>
```

Alternatively, if you are using the div embedding method, the parameter is placed after the data-trustmary-widget variable:

```javascript
<div data-trustmary-widget="<YOUR_WIDGET_ID>?title=A+title+for+this+location" />
```

### Change the product name field in structured data

If Schema.org structured data is included with the widget it might be useful to set the productName field to reflect the content of the widget. Especially, when listing reviews for a single business location or a product, the productName field should refer to that item instead of the whole company. Use the **productName** parameter to change the product name in the structured data:

```javascript
<script src="https://widget.trustmary.com/<YOUR_WIDGET_ID>?productName=product+name"></script>
```


# Filtering reviews with parameters

You can also filter reviews into the widget by review connection, tags, and custom rules (contact and review fields).

### Filter by review connection (continued)

As shown in the example before, it is possible to display only reviews that have been imported from a specific review connection (Google, Facebook, Tripadvisor, etc.).

Here are some advanced steps you can take when filtering reviews like this.

Below you'll see the "basic" form of how to use the connection parameter This will display only reviews that have been imported from the review connection you have given the short name of "my-connection".

```javascript
<script src="https://widget.trustmary.com/<YOUR_WIDGET_ID>?connection=my-connection"></script>
```

**Multiple connections** can be specified as a comma-separated list:

```javascript
<script src="https://widget.trustmary.com/<YOUR_WIDGET_ID>?connection=my-connection,connection2,my-other-connection"></script>
```

**A wildcard** can be used to select all connections with a matching short name. In the below example all review connections with a short name that starts with "helsinki-" are selected:

```javascript
<script src="https://widget.trustmary.com/<YOUR_WIDGET_ID>?connection=helsinki-*"></script>
```

If you're using the **<div> embedding method**, the connection parameter would look like this:

```javascript
<div data-trustmary-widget="<YOUR_WIDGET_ID>?connection=my-connection" />
```

### Filter by tags

It is possible to display reviews by tag. You can give the tag (or a comma separated list of tags) as the name for the tag or the tag ID. The following examples filter by a tag with the name "My tag" or the ID "12345", respectively:

```javascript
<script src="https://widget.trustmary.com/<YOUR_WIDGET_ID>?tag=My+tag"></script>
<script src="https://widget.trustmary.com/<YOUR_WIDGET_ID>?tag=12345"></script>
```

### Custom rules (contact and survey fields)

Custom rules can be used to filter by **contact or survey fields**.

Some example use cases:
* You have multiple business locations and your website has separate subpages for each location. It is possible to use the location as a parameter to display just the reviews for that location.
* You want to display reviews from a subset of customers that e.g. bought a specific product.

For example, if you want to display reviews for your Helsinki location, and you have collected the survey answers so that the **p1 segment** is set to the location name, the filter can be set as below:

```javascript
<script src="https://widget.trustmary.com/<YOUR_WIDGET_ID>?survey.p1=Helsinki"></script>
```

Available fields for surveys:
* **survey.source**: the source URL for a survey as automatically set by the widget
* **survey.p1**– **survey.p20**: the segmentation parameters as given as the form URL query parameters
* Wildcards can be used to match a field partially, e.g. `?survey.p1=*Helsinki*` (will match if "Helsinki" is found anywhere in `survey.p1`)

| Learn more about segmentation with parameters [here](https://help.trustmary.com/en/article/survey-answer-segmentation-with-parameters-sl63k8/).

You can also use the contact's custom fields. If you have stored the customer's primary location as the field **LOCATION**, you can use the following parameters:

```javascript
<script src="https://widget.trustmary.com/<YOUR_WIDGET_ID>?contact.field_LOCATION=Helsinki"></script>
```

The parameters given will be appended to the rules you might have set in the widget editor. E.g. if you have set a custom filter to display only reviews with five stars, adding a **p1** as a parameter will display only reviews with five stars that also have  **p1** set as the given value.

Available fields for contacts:
* **contact.field\_<FIELDNAME>**: a custom field as set in contact details.
* Wildcards can be used to match a field partially, e.g. `?contact.field_<FIELDNAME>=*Helsinki*` (will match if "Helsinki" is found anywhere in `contact.field_<FIELDNAME>`)

| Learn more about custom fields [here](https://help.trustmary.com/en/article/how-to-create-custom-fields-1enkkw9/).


# Segment parameter (m)

Use the segment parameter to connect review locations, surveys, and widgets. A probable use case for this would be to simplify collecting and displaying survey answers for a location when the account has multiple locations. 

* Review connections should have a shortname set to represent the location, e.g. `london` , `helsinki`
* Surveys can use the `m` parameter to mark the answers to be for that segment.
* Surveys can display and redirect to just the review connection that has the matching shortname: the final Thank you -page will only display the review connection that matches with `m` 
* The widget parameters `m` should be used with the same value as the shortname: `<script src="https://widget.trustmary.com/L4c5B3zYT?m=london"></script>` (displays all reviews from the review source with a matching shortname AND all the survey answers with the matching segment value)
* When sending survey invitations, the list of contacts can be **imported with the segment value** for each contact. The invitation emails will then have the `m` parameter included with the survey URL.
* It is possible to give a comma-separated list of segments to display reviews from any of them: `<script src="https://widget.trustmary.com/L4c5B3zYT?m=london,helsinki"></script>` 

# Highlight segment (h)


You can avoid empty and nearly widgets with the `h` parameter variant. The widget will display all reviews matching the `h` segment first and to fill the rest with other reviews. It is possible to mix with other filters as well. 

* To display the segment `london` first and fill the rest with any other segment: `<script src="https://widget.trustmary.com/L4c5B3zYT?h=london"></script>` 
* To display the segment `london` first and fill the rest with the `uk` segment: `<script src="https://widget.trustmary.com/L4c5B3zYT?h=london&m=uk"></script>` 
* It is possible to give a comma-separated list of segments to highlight reviews from any of them: `<script src="https://widget.trustmary.com/L4c5B3zYT?h=london,helsinki"></script>` 
