AdWords
2.4K members online now
2.4K members online now
Use AdWords conversion tracking and reporting to measure your results. Have a question about Google Analytics? Post it here, on the Google Analytics Community!
Guide Me
star_border
Reply

Re: Setting up conversion tracking for link clicks

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

http://www.comparetextbooks.net/bookdetail.php?bookid=673360

 

Any of the view details buttons should prompt a conversion.

1 Expert replyverified_user

Re: Setting up conversion tracking for link clicks

Top Contributor
# 2
Top Contributor

Hi rockthesasbah12,

 

I looked at the rendered page. Here's what one of the buttons looks like:

 

<input type="button" onclick="window.open('http://api2.campusbooks.com/link.php?params=s5CzcPjvRNCJMDT0UCiuwPjAgTTmiwBLUJKGMVgBoAflOstg-l-S_Qp3..." value="View Detail" class="greenbtnsmall" name="button2">

 

The onclick event no longer shows trackConv(), and that would be one good reason your conversions are not recording. And I did not find the function definition for trackConv() in any of the code. The onclick should be:

 

"trackConv();window.open('http://api2.campusbooks.com/link.php?params=s5CzcPjvRNCJMDT0UCiuwPjAgTTmiwBLUJKGMVgBoAflOstg-l-S_Qp3..."

 

Best of Luck!

 

Pete

 

petebardo -- Deadhead doing AdWords

Re: Setting up conversion tracking for link clicks

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
Hi Petebardo,

I figured it may be easier for you to see what's going on if I gave you the entire code for this certain snippet of the page:



&lt;script type="text/javascript">
function trackConv() {
var google_conversion_id = 1021483684;
var google_conversion_label =
"cjQ_CIKb4AIQpLWK5wM";
image = new Image(1,1);
image.src="http://www.googleadservices.com/pagead/
conversion/"+google_conversion_id+"/?label="+google_conversion_label
+"&script=0";
}
&lt;/script&gt;

<?php


//Campus Books API

$apikey = "CTNWgLEKD7fq9AHQuib";
$isbn = $_POST["isbn"];
//$isbn = "9780756613945";

switch ($_POST["search_type"])
{

case 1:
$function = "prices";
$q = "key=" . $apikey . "&isbn=" . $isbn;
break;
case 2:
$function = "buybackprices";
$q = "key=" . $apikey . "&isbn=" . $isbn;
break;
default:
$function = "prices";
$q = "key=" . $apikey . "&isbn=" . $isbn;
}

$uri = "http://api2.campusbooks.com/12/rest/" . $function . "?" . $q;

$ch = curl_init($uri);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//curl_setopt($ch, CURLOPT_PROXY, "cacheusu.oepm.local:8080");
//curl_setopt($ch, CURLOPT_PROXYPORT, 8080);
//curl_setopt ($ch, CURLOPT_PROXYUSERPWD, "rpi\xtauton2:Juninh01");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 25);

$x = curl_exec($ch);

if (curl_errno($ch))
{
$msg = "Error connecting the service. Try again later.";
echo "<div style='width: 80%; text-align: left; padding: 10px; background-color: white; margin-left: auto; margin-right: auto; font-weight: 800; color: #184E2D; font-size: 14px; text-align: center;'><span>" . $msg . "</span></div>";
exit;
}

curl_close($ch);

try
{
$xml = simplexml_load_string($x);
}
catch (Exception $e)
{
$msg = "Error connecting the service. Try again later." . curl_exec($ch);
echo "<div style='width: 80%; text-align: left; padding: 10px; background-color: white; margin-left: auto; margin-right: auto; font-weight: 800; color: #184E2D; font-size: 14px; text-align: center;'><span>" . $msg . "</span></div>";
exit;
}


$dato0 = $xml->xpath("//response");
$status = $dato0[0]->attributes()->status;

if ($status!="ok")
{

$msg = "";
$m = $xml->xpath("//response/errors/error");

foreach ($m as $d)
{
$msg .= $d . "</br>";
}

echo "<div style='width: 80%; text-align: left; padding: 10px; background-color: white; margin-left: auto; margin-right: auto; font-weight: 800; color: #184E2D; font-size: 14px; text-align: center;'><span>" . $msg . "</span></div>";
exit();
}

$dato0 = $xml->xpath("//offers");

if (count($dato0) == 0)
{
$msg = "No results. Try searching again.";
echo "<div style='width: 80%; text-align: left; padding: 10px; background-color: white; margin-left: auto; margin-right: auto; font-weight: 800; color: #184E2D; font-size: 14px; text-align: center;'><span>" . $msg . "</span></div>";
exit;
}

switch ($_POST["search_type"])
{

case 2:

$dato0 = $xml->xpath("//merchant");

echo "<p style=\"color: #999999;\">Click on table headers to sort results.</p>";
echo "<table id=\"searchtable\" class=\"tablesorter\">";
echo "<thead><tr><th>Buyer</th><th>Price</th><th>Condition</th><th style=\"cursor: default;\">Sell</th></thead>";
echo "<tbody>";

foreach ($dato0 as $d)
{

unset($dato1);
$dato1 = $d->xpath("prices/price");

foreach ($dato1 as $p)
{
echo "<tr class=\"search_tr\"><td><img alt=\"" . $d->name . "\" src=\"" . $d->merchant_image . "\" /></td><td>" . $p . "</td><td>" . strtoupper($p->attributes()->condition) . "</td><td><input name=\"button2\" type=\"button\" class=\"greenbtnsmall\" value=\"View Detail\" onclick=\"trackConv();window.open('" . $d->link . "');\"></td></tr>";
}

}

echo "</tbody>";
echo "</table>";

$sorter = "2: { sorter: false }";
$sort_order = "1";

break;

default:

$dato0 = $xml->xpath("//offer");

echo "<p style=\"color: #999999;\">Click on table headers to sort results.</p>";
echo "<table id=\"searchtable\" class=\"tablesorter\">";
echo "<thead><tr><th>Seller</th><th>Price</th><th>Condition</th><th style=\"cursor: default;\">Buy</th></thead>";
echo "<tbody>";

foreach ($dato0 as $d)
{

echo "<tr class=\"search_tr\"><td><img alt=\"" . $d->merchant_name . "\" src=\"" . $d->merchant_image . "\" /></td><td>\$" . $d->price . "</td><td>" . $d->condition_text . "</td><td><input name=\"button2\" type=\"button\" class=\"greenbtnsmall\" value=\"View Detail\" onclick=\"window.open('" . $d->link . "');\"></td></tr>";

}

echo "</tbody>";
echo "</table>";

$sorter = "3: { sorter: false }";
$sort_order = "0";

break;
}


?>

&lt;script type="text/javascript">

$(".tablesorter").tablesorter({
// sort on the first column and third column, order asc
sortList: [[1,<?php echo $sort_order; ?>]],
textExtraction: function(node) { if ($(node).find("img").length>0) { return $(node).find("img").attr("alt"); } else { return node.innerHTML; } },
headers: { <?php echo $sorter; ?> }
});

&lt;/script&gt;