PaddyStacks
PaddyStacks

Reputation: 31

Gatsby: Problem with loading 3rd party scripts

I'm playing around with this Gatsby Starter: https://github.com/thriveweb/yellowcake/ All I did, for now, was trying to add 3rd party scripts like google AdSense to see if it's working.

I've added the Google Adsense code in the snippet injection option in the Netlify settings.

So, the problem is that the banners appear only after I refresh the page. Is there a way to force scripts all the time in Gatsby?

Upvotes: 2

Views: 834

Answers (1)

Marko
Marko

Reputation: 390

Install this plugin

https://www.gatsbyjs.org/packages/gatsby-plugin-react-helmet/

and then inside of your code you can do this

<Helmet>
    <script src="something.com" crossorigin="anonymous"></script>
</Helmet>

Upvotes: 2

Related Questions