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

135
Visualizações
Mixpanel last non-direct traffic source

I was following mixpanel's documentation for how to track last known UTMs parameters.

then i noticed it is not useful in cases where the last traffic source is without UTMs such as from google organic, in such cases it will not register google organic as traffic source and will give the last credit to the last known UTM. How can i modify the script provided in the documentation in order for it to register last known non-UTM traffic sources as well? Thanks!

function getQueryParam(url, param) {
// Expects a raw URL
param = param.replace(/[[]/, "\[").replace(/[]]/, "\]");
var regexS = "[\?&]" + param + "=([^&#]*)",
    regex = new RegExp( regexS ),
    results = regex.exec(url);
if (results === null || (results && typeof(results[1]) !== 'string' && results[1].length)) {
  return '';
  } else {
  return decodeURIComponent(results[1]).replace(/\W/gi, ' ');
  }
};
function campaignParams() {
var campaign_keywords = 'utm_source utm_medium utm_campaign utm_content utm_term'.split(' ')
    , kw = ''
    , params = {}
    , first_params = {};
var index;
for (index = 0; index < campaign_keywords.length; ++index) {
  kw = getQueryParam(document.URL, campaign_keywords[index]);
  if (kw.length) {
    params[campaign_keywords[index] + ' [last touch]'] = kw;
  }
}
for (index = 0; index < campaign_keywords.length; ++index) {
  kw = getQueryParam(document.URL, campaign_keywords[index]);
  if (kw.length) {
    first_params[campaign_keywords[index] + ' [first touch]'] = kw;
  }
}
mixpanel.people.set(params);
mixpanel.people.set_once(first_params);
mixpanel.register(params);
}
campaignParams();

about 4 years ago · Juan Pablo Isaza
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