Home

Awesome

<a href="https://beyonk.com"> <br /> <br /> <img src="https://user-images.githubusercontent.com/218949/144224348-1b3a20d5-d68e-4a7a-b6ac-6946f19f4a86.png" width="198" /> <br /> <br /> </a>

Svelte Trustpilot

js-standard-style CircleCI svelte-v2 svelte-v3

Pure vanilla JS Trustpilot integration

trustpilot

Install

$ npm install --save-dev @beyonk/svelte-trustpilot

Usage (With Svelte)

<Trustpilot businessUnit="12345" domain="www.example.com"  />

<script>
  import Trustpilot from '@beyonk/svelte-trustpilot'
</script>

The attributes you pass to the Trusilot component are listed below, but you need domain and businessUnit at a minimum.

Usage (Vanilla JS)

<div id="trustpilot-wrapper"></div>

<script>
  import Trustpilot from '@beyonk/svelte-trustpilot'

	const trustpilot = new Trustpilot({
		target: document.querySelector('#trustpilot-wrapper'),
		data: {
			businessUnit: '12345',
			domain: 'www.example.com'
		}
	})
</script>

Other configuration attributes

There are a number of configuration attributes you can pass, but all are optional.

List of possible options in the module:

OptionDefaultRequiredDescription
widget (1)micro-starfalseWidget type as per [https://businessapp.b2b.trustpilot.com/?locale=en-US#/integrations/trustbox/library](Trustpilot Trustbox library)
domain-trueSets the domain/product name on Trustpilot (for the link when a user clicks your widget)
businessUnit-trueSets data-businessunit-id as per docs
width100%falseSets data-style-width as per docs
height500pxfalseSets data-style-height as per docs
themedarkfalseSets data-theme as per Trustpilot docs
libpackage-namefalseUnique id to determine if component is loaded. You probably don't need to change this.
versionv5falseTrustpilot SDK version (best not to change)
* (2)-falsePass any other parameter you want here. See below.
  1. You can pass any widget template name in its hyphenated form, or, just pass the template id here instead. You can get the template id from the trustpilot integration url:

https://businessapp.b2b.trustpilot.com/?locale=en-US#/integrations/trustbox/configuration/<widget-id-is-here>

  1. You can pass any data- attribute you normally pass to Trustpilot's widgets. These will be passed verbatim to the underlying widget HTML.

License

MIT License