Google says this should be added to html on the "conversion page".
<!-- Event snippet for Website lead conversion page --> <script> gtag('event', 'conversion', {'send_to': 'AW-sdad/-dsafdsa'}); </script>
I have a ReactJS app, so I have no single html "conversion page".
Can I run it from javascript somehow?
createAccount = () => {
Axios.post(`/api/signup`, { user })
.then(async (resp) => {
await Axios.post("/api/login", { email: this.state.email, password: this.state.password });
this.props.history.push("/app");
// Run google ad convert here?
})
.catch((err) => {
console.log(err);
});
};
Use React Helmet. It basically helps you to change something inside <head>
or <body>
So you just need to add that piece of code inside your component responsible for your conversion page.
const SignUpPage = () => {
return (
<div>
<Helmet>
<!-- Event snippet for Website lead conversion page -->
<script> gtag('event', 'conversion', {'send_to': 'AW-sdad/-dsafdsa'}); </script>
</Helmet>
SignIn page here
</div>
);
};