autoAds adsense

Hello,
my client wants to have this https://support.google.com/adsense/answer/9261307?hl=en on the site.
anybody knows how I can do that, and if it is complicated ?

I used this to add an external script in react.

This could help with getting the adsense script added too. Good luck!

export const TwitchEmbed = ({channel, layout, autoplay, muted}) => {
   useEffect(() => {
     let embed;

     const script = document.createElement('script');

     script.setAttribute(
       'src',
       'https://embed.twitch.tv/embed/v1.js'
     );

     script.addEventListener('load', () => {
        embed = new Twitch.Player('twitch-embed', {
          width: "100%",
          height: "100%",
          channel: channel,
          layout: layout,
          autoplay: autoplay, 
          muted: muted,
        });
     });

     document.body.appendChild(script);
   }, []);

   return (
     <div id="twitch-embed" style={{width: "1100px", height: "429px", margin: "0 auto"}}></div>
   )
}
2 Likes

Hi @alexaspalato,

You can load any script in the header of your HTML pages generated by Frontity by placing that script tag inside the <Head> component provided by Frontity

Something like this…

        <Head>
          <meta name="description" content={state.frontity.description} />
          <html lang="en" />
          <script>{`alert("Hello from script tag in header")`}</script>
        </Head>

Here you have a quick demo of this → https://github.com/frontity-demos/frontity-examples/tree/master/demo-frontity-script-head

Let us know if this solution allow you to implement that service in your Frontity project