I want to use the google tag manager script just for the signup page. I don't want them for other pages. How can I add a condition in the index.html file in react to get the current URL?
I have already added the code to check if the environment is in production or not. This was the code
<% if (process.env.NODE_ENV === 'production') { %>
<!-- Meta Pixel Code -->
<script>
...
</script>
<% } %>
But now to get the URL or pathname when I give the below code I'm getting a "window not defined" error. Do we have a way to get the URL in index.html file for react?
<% if (window.location.pathname === '/signup') { %>