Closed Soviut closed 5 years ago
I can't give any further instructions without any demo project
Yes, sorry, I've been meaning to follow this up with an explanation of the issue and how we solved it. Hopefully I can clarify that this week.
The solution was that we needed to do a nuxt build && nuxt start
so that it picked up the new production environment variables.
Even though nuxt.config.js is dynamic, somewhere along the line the environment variables in its structure get baked into the build.
I have the following google-gtag nuxt config
It works fine locally; no errors, events are triggered.
My circleCI build puts it all into a Docker container and deploys to heroku. I have those environment variables set in the Heroku dashboard. The
NODE_ENV
isproduction
on Heroku.I've logged into the container and made sure the variables are being imported, going as far as to start node and
require('./nuxt.config.js')
to make sure theid
is being set properly.No matter what, the google tag script element isn't added to the head of the page. As such, I get the following error when trying to access
this.$gtag
to trigger events.