Jump to content

Brain Fried, need some help please!


DonH

Recommended Posts

I have been working on this matter for about a week now and driving myself so nuts that now I can not even think right.

 

Here's the problem.

 

I have a banner script which is used to display banners on my pages. It pulls from MySQL database and works fine.

 

The part that works fine is this:

 

if ($adtype == 1) {
echo "<a href=\"$site_url/banner.php?id=".$id."&action=show\" target=\"$target_text\" onFocus=\"this.blur()\"><img border=\"$border\" style=\"border-color: $border_color\" src=\"$site_url/$image\" title=\"$alt\" alt=\"$alt\"></a>";
}

 

This part displays local banners and counts the views and clicks just fine.

 

This part displays the HTML snips like affiliate codes and such which are complete tags from elsewhere.

 

else {
echo $adtext;
}

 

The ads display just fine. Counts views for both types of ads using the SHOW fucntion.

 

if ($action == "show") {
$query = "SELECT * FROM $banners WHERE id = $id";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result);
$link = $row['link'];
if (strtolower(substr($link,0,5)) != "http:")
$link = "http://" . $link;
$today = date("d m Y");
$query = "SELECT * FROM $stats WHERE date_format(ezban_date, '%d %m %Y') = '$today' AND id = $id";
$result = mysql_query($query) or die(mysql_error());
$num_results = mysql_num_rows($result);
$today = date("Y-m-d"); 
$query = "UPDATE $stats SET clicks = clicks + 1 WHERE id = $id AND ezban_date = '$today'";
$result = mysql_query($query) or die(mysql_error());
header("Location: ".$link);
}

 

What I need is to count the CLICKS for the HTML snip codes.

 

The

$adtext;

displays the ads fine pulling from the database but will NOT count the clicks. I know it is

because I can not call the SHOW function to increase the clicks like I do with local banners.

 

While going crazy I tried this to insure I am in the right place.

 

echo "<a href=\"$site_url/banner.php?id=".$id."&action=show\" target=\"$target_text\" onFocus=\"this.blur()\">1";
echo $adtext;
echo "</a>";

 

Which is NOT correct I know... BUT if I click on the number 1 displayed with this code it increments the clicks by one.

Mainly because I am calling the SHOW function.

 

I need a way to either call the SHOW function for the ads that are pulled and displayed using $adtext

or another function that can be used to do the same thing to count clicks.

 

Any help on this matter would be greatly appreciated! I also hope I am making sense here... Like I said, my brain is gone!

Link to comment
Share on other sites

First I would like to thank you for responding. I didn't receive any notice of a response and was getting quite dis-heartened by that.

 

Anyway, I will try to narrow my need for help.

 

The problem:

 

I pull ad snippets from my database using this echo tag.

echo $adtext 

 

which pulls and siplays on a webpage

<a href="http://www.domain.com" target="_blank"><img src="http://www.domain.com/banner/images/banner1.gif" border="0"></a>

 

Or what ever the particular affiliate code may be.

 

This displays the ads fine and it counts the number of times this snippet has been viewed.

 

What it will NOT do is count the number of clicks on each snippet.

 

The main reason is this.

echo $adtext;

 

Doesn't call any function or action to increment the count clicks.

 

This is what I need help with. How can I get, make or do a call to the action/function showURL when the echo tag is

echo $adtext;

 

My local banners call the SHOW function using the following.

if ($adtype == 1) {  
echo "<a href=\"$site_url/banner.php?id=".$id."&action=show\" target=\"$target_text\" onFocus=\"this.blur()\"><img border=\"$border\" style=\"border-color: $border_color\" src=\"$site_url/$image\" title=\"$alt\" alt=\"$alt\"></a>";  
}

 

If it is NOT a local banner, adtype == 1, it uses ELSE to display the ADTEXT. Therefore never calling or triggering the showURL action as I can not figure out how to trigger it from

echo $adtext;

Link to comment
Share on other sites

As I can get it best from what you told:

 

In your first text you have written that you don't have access to the code the affiliate ads will contain. So I don't think you can, by any means, track the clicks. And that is because they are leading the users to external pages.

 

There is a way around for that but your ad providers will not like this if they see it.

You can change the affiliate code:

 

$adtext="<a href=\"http://externalsite.com/?pid=something\">Link title</a>";

 

to

 

$adtext="<a href=\"http://$site_url/extbannertrack.php?url=http%3A%2F%2Fexternalsite.com%2F%3Fpid%3Dsomething\">Link title</a>";

 

That can be done dynamicly using preg_replace.

 

Hope it helps. :-)

 

Link to comment
Share on other sites

auro,

thank for the reply... But this will not work! This is why it is such a problem.

 

By default, the ADTEXT tag calls and prints to the webpages a full and complete banner ad.

 

<a href="http://www.domain.com" target="_blank"><img src="http://www.domain.com/banner/images/banner1.gif" border="0"></a>

 

So the simple solution of just chnaging the ADTEXT is not possible.

 

The echo tag pull s out of the database whatever the full affiliate is for each banner.

 

Since I do not know of a way to pull a link within a link...

 

Or to have the banner show on the pages complete and still be able to track the links...

 

See my problem?

 

This is not a simple solution... But one I must find a solution for.

 

Again, the

echo $adtext;

 

prints out the full and complete banner affiliate code like from Commision Junction, Link Share etc.

 

Therefore the link and image are already present once pulled from the MySQL database.

 

Getting the

echo $adtext;

to count the clicks is the problem as you can not wrap a link over a link or as the banner itself must be displayed with the link in the first place... This is the problem.

 

Make more sense?

Link to comment
Share on other sites

The echo tag pull s out of the database whatever the full affiliate is for each banner.

 

What do you mean by this? The echo function does not pull anything out of a database. It just outputs whatever is called in it. So

echo $adtext;

outputs whatever is inside of $adtext. Where is $adtext being assigned? None of the code you posted makes it clear.

 

What would you say your experience is with PHP? I might be able to foster a full explanation for you.

Link to comment
Share on other sites

foxtrotwhiskey,

thank for your reply.

 

echo $adtext;

 

Is pulled from my database in a else statement and this part works fine. In the function

 

if ($adtype == 1) {
else
$adtext

 

In the ad new banner form is a place to choose either standard local banner or input a HTML snippet or affiliate link code.

 

When called in pulls either the local banner which works fine. Or the adtext which pulls the entire code snippet and displays in on the webpage.

 

This all works fine it is after this.

 

ADTEXT pulls and displays simular to this.

 

<a href="http://www.domain.com" target="_blank"><img src="http://www.domain.com/banner/images/banner1.gif" border="0"></a>

 

And it counts the displays fine as well.

 

What I need is to ALSO count the clicks on the ADTEXT banners.

 

Since it pulls and displays the full, complete banner code using the echo... But not the clicks.

 

So the question is how do I count the clicks on the adtext? Everything I try just counts the displays again.

 

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.