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
Append cookie value to query string on initial page load?

I have a situation and I am not sure how to solve it.

I am using a script in Google Tag Manager to define where marketing sources are coming from (i.e. organic search, organic social, paid search, referral, direct traffic, etc.).

I am taking the data from that script and storing it in a 1st party cookie & first party cookie variable.

However, I need the data from the cookie to populate in the URL query string, similar to how utms populate in a query string when someone clicks a Google Ad.

For example, when someone clicks on a Google ad, they arrive on the landing page and the URL looks something like this www.examplesite.com/?utm_source=Google&utm_medium=ppc&utm_campaign=example

I need similar functionality to that. So in my example, if someone came from an organic search result, I would want it to look like this:

www.examplesite.com/?Source=Organic&SourceDetail=Google.

Is this even possible to do on the initial page?

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

0

Yes, there are a few ways of going around it. I will only highlight the most elegant option, but first, you don't need to touch your query string. You can override the string that is being sent to GA with GTM. It's a lot more elegant than tinkering with the user-exposed front-end. Here is how:

enter image description here

That's how you override your location dimension (dl) in your pageview tag.

Now the only thing that remains is to make that custom javascript variable returning a string that would be just your current url with the proper utm-params appended to it.

This is a very clean and non-intrusive implementation. You can also do it on a GA settings variable level, which may be even a better solution, depending on your situation.

Also, you can override your source/medium using an event, rather than a pageview, but be careful with events. A change of source/medium will force GA to generate a brand new session for this user. That is done to be able to build different attribution models on the same dataset.

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