If you want to create a custom TrustBox widget to display your Trustpilot reviews and ratings on your website, you can build one using our APIs. Read on to learn how to get started.
This requires some technical knowledge to set up, so consider asking your developer for help.
Before you start showcasing Trustpilot review content, it’s important to know how we identify domains via Business Unit IDs, also known as BUIDs. The business unit is the collection point for all Trustpilot content for a website. In other words, the business unit hosts a business's rating, its reviews, and the business's responses. The BUID is a unique identifier for that business unit and is the primary key in many of your API calls. You can read more about BUIDs here.
Finding a BUID
Your Business Unit ID is a unique identifier specific to your domain. It’s static and will only change if your domain on Trustpilot changes. To find the BUID for your domain, you’ll need to use the Find a business unit endpoint. The required parameter here is the “name” of the business unit, i.e. your website’s domain. As a quick example, if you wanted to look up the BUID of Trustpilot, you’d pass along the string “trustpilot.com”.
Try it yourself, just remember to replace the API key.
Once you get the response back, you want the “id” field. This is your BUID for the domain you just searched.
Pulling in Reviews
Once you have the BUID for your domain, you can start pulling your reviews, ratings, and your replies to those reviews by using the API call Get a business unit’s reviews.
If you want to just pull in the public info about the Business Unit (i.e. star rating, number of reviews, TrustScore, etc.), this data is available in the Find a business unit endpoint listed above. You can also use Get public business unit.
Custom Integration Guidelines
In order to ensure that you’re aligning with our guidelines, we suggest checking out our detailed support doc on Trustpilot APIs - Service Review Integration Guidelines.
Here’s a few key takeaways:
- You must always disclose which reviews you're displaying. For example, if you're showing 4 and 5-star reviews, you'll need to indicate this.
- Don't expose your API key in the frontend. This means that you should only be making API calls from the backend, then passing the data to the frontend for display.
- To avoid rate limiting issues, don’t make an API call each time the page loads — cache the data on your side and update it every 30 mins/1 hour/24 hours, etc. You can also take advantage of our webhooks to update reviews in real-time.
- Your widget's review text shouldn’t be indexable by Google. This helps prevent duplicate content penalties from damaging your search engine rankings. Instead, host your widgets on a separate page (eg. a subdomain) where you have a <meta name="robots" content="noindex"> tag in the head. From there, you can use an <iframe> to show the TrustBox widget on your main website.
Server Side API Calls
All API calls need to be made server side to ensure security. By doing so, it'll ensure your private API key is not exposed on your website and can also help improve page load speeds/decrease network costs.
When displaying custom TrustBox widgets on your site, we recommend to cache the data. Caching increases performance and reliability. Performance is increased because the source of cached data can be closer to the consumer and the cache can process duplicated requests for data, saving unnecessary computations and network traffic. Reliability is increased because the data consumer is isolated from service interruptions from origin.