daniel couzens
daniel couzens

Reputation: 41

embed third party script tag in a gatsby.js website

I am trying to use a widget in a gatsby.js site but cant find a way of creating a react component that works!

<div>
  <script src="https://widgets.bookalet.co.uk/publish.js" data-bookalet="b41d3564-11ba-4a54-9ee2-b7d6ec55b214" data-property="13563"></script>
</div> 

This is what the widget looks like. Its the data-bookalet and data-property attributes that seem to be the anomalies I cant find answers to!

Upvotes: 3

Views: 1485

Answers (1)

brooksrelyt
brooksrelyt

Reputation: 4025

You can try using React Helmet and implementing it something like this:

<Helmet>
    <script>
        {`YOUR_SCRIPT_HERE`}
    </script>
</Helmet>

Source: react-helmet documentation and gatsby-plugin-react-helmet

Upvotes: 2

Related Questions