title: Facebook pixel in react page
body: <p>That is probably the easiest question for some of you, but I can't figure out how to add facebook pixel event to react page. I'm using Gatsbyjs and trying to add pageview event on /thank-you page. </p>
  
  <pre><code>import React from 'react';
  import '../../components/genflow.sass';
  import Helmet from '../../components/helmet';
  import Navbar from '../../components/navbar';
  import Footer from '../../components/footer';
  
  const ThankYouPage = () =&gt; (
  
  &lt;div&gt;
  &lt;Helmet/&gt;
  
    &lt;section className="hero influencer-hero page-hero gradientBg"&gt;
          &lt;Navbar /&gt;
          &lt;div className="hero-body page-body"&gt;
              &lt;div className="container center"&gt;
                  &lt;article className="media"&gt;
                      &lt;div className="media-content"&gt;
                          &lt;div className="content"&gt;
                              &lt;h1 className="is-size-2 has-text-white"&gt;
                                  Thank you
                              &lt;/h1&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/article&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/section&gt;
  
      &lt;section className='section'&gt;
        &lt;div className='container'&gt;
            &lt;div className='columns'&gt;
              &lt;div className='column title-col is-10 is-offset-1'&gt;
                &lt;div className='content'&gt;
                  &lt;div className='has-text-centered'&gt;
  
                    &lt;p&gt;Thank you for your message. We will get back to you soon.&lt;/p&gt;
  
                  &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt;
      &lt;/section&gt;
  
  &lt;Footer/&gt;
  
  &lt;/div&gt;
  
  );
  
  export default ThankYouPage;
  </code></pre>
  
  <p>If I add the fb pixel script at the end of the page with <em>dangerouslySetInnerHTML</em> I get errors. Not sure what is the best solution here. I'm newbie in programming, so please bear with me. Thanks</p>