/
pagina.html
40 lines (35 loc) · 1.64 KB
/
pagina.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PAGINA TESTE | KTMS permanência de UTMs</title>
</head>
<body>
<h1>Página de testes da biblioteca</h1>
<a href="pagina-2.html" class="utm-params">Inspecione ou clique para testar a URL sem paramêtros</a>
<a href="pagina-2.html?parametro_teste=1" class="utm-params">Inspecione ou clique para testar a URL com paramêtros</a>
<a href="pagina-2.html">Inspecione ou clique para testar a URL sem classe KTMS</a>
<script src="ktms.js"></script>
<script>
console.log('utm source', typeof(ktms.getUtm('utm_source')), ktms.getUtm('utm_source'));
console.log('utm inexistente', typeof(ktms.getUtm('utm_alguma')), ktms.getUtm('utm_alguma'));
</script>
<script>
ktms.load(function(){
var umtCampanha = ktms.getUtm('utm_campaign');
var utmOrigem = ktms.getUtm('utm_source');
var utmConteudo = ktms.getUtm('utm_content');
var utmIntermediario = ktms.getUtm('utm_medium');
var utm_termo = ktms.getUtm('utm_term');
var utmParams = {};
if(umtCampanha) { utmParams['utm_campanha'] = umtCampanha; }
if(utmOrigem) { utmParams['utm_origem'] = utmOrigem; }
if(utmConteudo) { utmParams['utm_conteudo'] = utmConteudo; }
if(utmIntermediario) { utmParams['utm_intermediario'] = utmIntermediario; }
if(utm_termo) { utmParams['utm_termo'] = utm_termo; }
console.log('utmParams', utmParams);
});
</script>
</body>
</html>