LOL @ my thread name.
I wanted to ask how to grab the token from my cpvlab tracking url, so that it greets visitors from a certain placement?
My token is &keyword={placement}
The placement grabs the domain name from where the visitor clicked a Google ad.
I want the landing page to then show "Hello, visitors from [insert placement here]"
And if it doesn't find a placement token, or that a placement is iamwatchingporn.com, don't show the text at all.
How can I do this?
First of all, in CPV Lab on the Edit Campaign screen, make sure that you have the box checked for "Pass Target to Landing Page":

Next, place this code where you want the target to appear:
[PHP]<?php echo($_GET["target"]) ?>[/PHP]
Or to have it formatted with the Domain and Uppercase, place this code instead:
[PHP]<?php $target = str_replace('http://', '', str_replace('https://', '', str_replace('www.', '', $_GET["target"]))); echo(ucfirst(strpos($target,'/') !== false ? substr($target,0,strpos($target,'/')) : $target)); ?>[/PHP]
So your LP should have something like this on it:
[PHP]Hello, visitors from <?php echo($_GET["target"]) ?>[/PHP]
Also make sure to save your LP as a .php file instead of .html and you should be set.
Is there a way to make
Hello, visitors from <?php echo($_GET["target"]) ?>
Whole line.
The variable itself won't show if there is no target. That's why I usually word it like "Hello _____ Visitors" because then if the variable is missing it won't look like a broken sentence. I don't know of a way to make the whole line disappear, but I'm not a programmer.
Yeah can be done pretty easily :
[PHP]
<?php
$target = str_replace('http://', '', str_replace('https://', '', str_replace('www.', '', $_GET["target"])));
if($target!="spy.com")
echo "Hello, visitors from $target";
?>
[/PHP]
Change spy.com with whatever domain you want.
[PHP]if (isset($_GET["target"])) {
echo "Official $_GET["target"] Notice";
}[/PHP]
Just to expand a little on this: if you have multiple sites that you don't want the message to show, or maybe a different message, you could do it like this:
[PHP]$target = str_replace('http://', '', str_replace('https://', '', str_replace('www.', '', $_GET["target"])));
$no_show = array('spy.com','otherdomain.com','etc.com');
if($target != '' && !in_array($target, $no_show){
echo "Hello, visitor from $target";
}else{
echo "Hello, visitor";
//or delete the above to not show any message
}
[/PHP]