Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

97
Views
Google Analytics Measurement Id as Environment Variable

I just started using Google Analytics and I have my code in my base html file for a Django web app.

<!-- Global site tag (gtag.js) - Google Analytics -->        
<script nonce="{{ CSP_NONCE }}" async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXX"></script>
<script nonce="{{ CSP_NONCE }}">
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('js', new Date());
    gtag("config","G-XXXXXXXXX");
</script>
<!-- end GA -->

My question is, for the measurement id (G-XXXXXXXXX) is this something that needs to be a secret? I keep all my keys, etc in the env file and though I could do the same with this id but I keep running into errors. I tried {% 'GOOGLE_ID' %} but that didn't work.

Is there a good way to implement this?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!