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

148
Views
Agregue el src de html dentro de JavaScript

Tengo un código HTML que tiene solo una línea de código:

 <script async src="https://www.googletagmanager.com/gtag/js?id=ID"></script>

Pero no quiero usar HTML en absoluto. Dado que estoy realizando todas mis funciones dentro de mi javascript, ¿puedo agregar el código anterior dentro de mi JavaScript? ¿Si es así, cómo?

 window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'ID');
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Para responder a mi propia pregunta retórica, hay una manera de agregar una URL dentro de mi javascript de esta manera:

 function appendScript(){ var script = document.createElement("script"); script.src = "https://www.googletagmanager.com/gtag/js?id=ID"; document.head.appendChild(script); } appendScript();
about 4 years ago · Juan Pablo Isaza Report
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!