Add widget to an email

This could be achieved by using an ‘HTML to Image’ module (eg. Search · "html to image" · GitHub) to pre-render an image of the widget (eg. a Badge), this way any customisations/configs and custom CSS still work. You can then overwrite that image after each review import (hourly/daily?), and host it with a CDN with a TTL setting (eg. 24 hours) to handle the client side and CDN cache invalidation.

In this way user could then embed the image in their website or emails (eg. src=“{{CDN url}}”), and it would automatically update with the latest version of the image.

This would also be cached which improves website performance… the web version could have the usual onclick javascript event to open the interactive Reviews Panel.

The current nature of the widgets has stopped us from including them above the fold on our website, due to the negative effect on Page Speed Insights (ie. due to the layout shift when the widget loads)… but by using a CDN cached image this issue would be solved!

1 Like