Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

77
Visualizações
Google Tag Manager - custom Templates - injectScript API never seems to run

I have been trying my hands on creating a custom template tag, like so:

Code

// Require the necessary APIs
const logToConsole = require('logToConsole');
const injectScript = require('injectScript');

// construct URL
const url = "https://www.dwin1.com/" + data.merchantId + '.js';

// If the user chose to log debug output, initialize the logging method
const log = data.debug ? logToConsole : (() => {});

log('AWIN: Loading script from ' + url);

// If the script loaded successfully, log a message and signal success
const onSuccess = () => {
  log('AWIN: Script loaded successfully.');
  data.gtmOnSuccess();
};

// If the script fails to load, log a message and signal failure
const onFailure = () => {
  log('AWIN: Script load failed.');
  data.gtmOnFailure();
};


injectScript(url, onSuccess, onFailure, url);

Permissions

URL Pattern match: https://www.dwin1.com/

Tests

but when I now try to run a test like so

const mockData = {
  merchantId: 1001,
  debug: true
};

// Call runCode to run the template's code.
runCode(mockData);

// Verify that the tag finished successfully.
assertApi('gtmOnSuccess').wasCalled();

I get this gnarly error and don't know why: enter image description here

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Hey even I faced the same issue, but as I debugged it was due to AdBlocker which was blocking the script, you need to allow it and check if you have any AdBlocker installed on your machine.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda