0

I run my website on a server that reverse proxies all requests to a nextjs server and google analytics does not work behind this proxy. I followed this implementation and everything works as intended when I run it on my own machine. The only reason that I can think that this doesn't work is because of the reverse proxy. I would like to still be able to implement google analytics via nextjs instead of adding it to the nginx config so that its easier to maintain. How can I make nextjs able to call google analytics when behind a proxy?

1 Answer 1

2

After some simple debugging that I somehow forgot to do before hand I figured out the problem, or so I think. I had my G-Tag stored in an ENV var and I found out that you need to build and start the server with the ENV vars already set before running it. Previously I had, Built -> Added the ENV vars -> Started the server. This was NOT a problem with nginx or google analytics, or really even nextjs.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.