Sign in
Log inSign up

Trying to add a script to a Gatsby site

AK's photo
AK
·Oct 1, 2019

Hello. Looking for help adding a script to a Gatsby site. I'm adding a tracking script for an affiliate program (Refersion). I tried adding it to the gatsby-ssr.js page but it's not working (code below). Anyone have any other ideas for how to add this script? Would appreciate any help.

import React from "react"; export function onRenderBody( { setHeadComponents } ) { setHeadComponents([ <script type="text/javascript" src="Subdomain.refersion.com/tracker/v3/pubKEY.js> _refersion(); </script>, ]); }

Hassle-free blogging platform that developers and teams love.
  • Docs by Hashnode
    New
  • Blogs
  • AI Markdown Editor
  • GraphQL APIs
  • Open source Starter-kit

© Hashnode 2024 — LinearBytes Inc.

Privacy PolicyTermsCode of Conduct