Shorten Google Analytics tracking URL (variables only)

Asked

Viewed 89 times

2

I would like to shorten a URL of my Wordpress site as follows:

www.meusite.com/?utm_source=FONTE&utm_medium=MEDIUM&utm_campaign=CAMPANHA

for something like

www.meusite.com/?urlencurtada

Where the ?urlencurtada will receive the entire parameter of ?utm_source=FONTE&utm_medium=MEDIUM&utm_campaign=CAMPANHA

The reason for this is that I want to share links on my hidden site that extensive amount of Analytics variables to a nickname that runs them when called.

example as I wish you to stay:

www.meusite.com/umlinkquepassaseguranca/?urlencurtada
www.meusite.com/?urlencurtada
www.meusite.com/umamateriaLimpanaURL/?urlencurtada
www.meusite.com/um-artigo-com-endereco-enorme/?urlencurtada

so it’s gonna get better than something like:

www.meusite.com/um-artigo-com-endereco-enorme/?urlencurtada

instead of:

www.meusite.com/um-artigo-com-endereco-enorme/?utm_source=FONTE&utm_medium=MEDIUM&utm_campaign=CAMPANHA

The goal of this is to track while maintaining the elegance of the url. This will influence the sharing of the same, and the security that will pass to those who see them..

  • Perhaps you can focus more on the question by checking these two tags in wp.se: endpoints and url-Rewriting. The problem is that you now have an answer and if you change the question you cannot leave the answer invalid, if it happens you have to create a new question.

1 answer

2


You could use a GET and Redirect together, this way:

www.meusite.com/? shortener=1

In php:

<?php
 if (!empty($_GET['encurtador']) {

   if($_GET['encurtador'] == 1) { header("location:www.meusite.com/?utm_source=FONTE&utm_medium=MEDIUM&utm_campaign=CAMPANHA");  }

}
?>
  • the tip is good but this had to be captured well before the $_GET, kind in the init: http://stackoverflow.com/q/24187090/1287812

Browser other questions tagged

You are not signed in. Login or sign up in order to post.