1

I want to construct a website I'm building in a way that would distinguish between visitors coming from organic sources (e.g, Google search), and paid sources (e.g, Google adwords).

Whenever a visitor would perform some sort of action, it would carry a string that would help me identify the source. I'm using PHP, and I suppose I would construct the website this way:

A. In general, all internal links in the website would never carry a string in their URL, so by default, every action would carry some default variable.

B. for paid traffic, visitors would reach a domain.com/index.php?source=paid type url, which would modify the default string to something else.

My concerns:

  1. Is this the best practice to do this?

  2. How do I prevent Search engines form mistakenly index both index.php and index.php?source=paid, which could cause my website to allegedly have duplicate content and hurt my rankings?

  3. for the whole website, I want to use some re-write rule, making my links look cleaner, e.g, domain.com/subscribe.php -> domain.com/subscribe, can this hinder anything?

Thanks!

rockyraw
  • 1,125
  • 2
  • 15
  • 36

2 Answers2

0
  1. I don't think is good idea to use variables to track (e.g, Google search) and (e.g, Google adwords) because you already have this functionality whit Google Analytics.

  2. You can submit to google web master tools pages you don't want to be indexed or just on the pages you have the code add meta tag whit NO-INDEX or use robot.txt but i don't suggest doing this.

  3. If you have clean and descriptive urls is better for you SEO so definitely you need some re-write rule.


If you decide anyway to do it whit php i think the best way will be to use

$_SERVER['HTTP_REFERER']

referer-variable to get the the last site the user was on before open your page and then store them in database so you can make reports later.


If you need to use url parameters for example www.mywebsite.com/home?marketing=someadcode have a look at this google URL parameters

Daniel Yovchev
  • 329
  • 3
  • 7
0

Tracking: What about cookies? I would do this with cookies.

#

And the Parameter, do something like this:

if($canonical_url != "" && strpos($url,"?"))
{
    $canonical = substr($url,0, strpos($url,"?"));
}

if(isset($canonical) && $canonical !="" && $noindex != "1")
{
    $canonical = str_replace('https:', 'http:',$canonical);
    echo '<link rel="canonical" href="'.$canonical.'" />';
}

For unknown parameters.

loebe
  • 17
  • 3