Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Ad Tracker (where did they come from) Update


Recommended Posts

:D I updated the Ad Tracker to include a fix for PHP 3.4.x that was causing query 'link' errors. In addition, I recently added a report that shows total revenue derived from each ad source.

 

Please note that this tracker should work with the latest build but was only tested on one from 12/2002. I haven't quite gotten around to updating to osCommerce 2.2MS1. I tried but I have way too many mods to bring over so I went back. :oops:

 

Anyway, please let me know if you run into any problems with this latest version. It works great for me and I've been using the report function religiously to track and update my google and overture campaigns.

 

To see a sample report:

http://www.100monkeys.org/images/store/adr...sultsreport.gif

 

Feedback is welcome and encouraged.

Adam

--------------------------------

got monkey? We do.

http://www.monkeygoods.com

Link to comment
Share on other sites

Hi,

 

I've tried using this mod on a recent snapshot (about 2 weeks old) but cannot seem to get any results from it. It all installed fine and I get no errors when creating new accounts or placing errors. The only problem is it does not seem to log any of the referrals. I am trying links like http://www.twocom.net/shop/default.php?ad=test.ad and going through and creating a new account and placing an order under this account but in customers and the ad report it does not show up where the referral came from.

 

Any tips?

 

Regards,

 

Paul Thomas

http://www.twocom.net

Link to comment
Share on other sites

Hi,

 

It could very well be me (as in my code is still newbie code)... However, just in case it's not, what you may want to try is adding some debug code in /catalog/default.php. For example, I have this just below the body tag:

 

<!-- $advertiser -->

 

Then I run a test where I go to the url with ?ad=whatever

 

If all goes well, you should see the ad string in that comment field when you view the html source of the processed page. It's possible that I'm missing something to bring session values over when the customer switches from the anonymous to the signed in state. However, the code is working for me...

 

Try the debug test and let me know if you can see the ad string throughout the user session AND after logging in. If it is working, the next step is to match up the variables in the insert function in /catalog/create_account_process.php.

Adam

--------------------------------

got monkey? We do.

http://www.monkeygoods.com

Link to comment
Share on other sites

Hi Adam,

 

I've just done what you suggested and it just shows <!-- $advertiser --> in the html source of the processed page ...

 

I've played around a bit in application_top.php but with no joy :(

 

Regards,

 

Paul

Link to comment
Share on other sites

What version of PHP are you using? We recently upgraded to 3.4.1 and had to add the following to the very top (right after all the comments) of catalog/includes/appliction_top.php to avoid some errors.

 

$HTTP_SERVER_VARS =& $_SERVER;

$HTTP_ENV_VARS =& $_ENV;

$HTTP_COOKIE_VARS =& $_COOKIE;

$HTTP_GET_VARS =& $_GET;

$HTTP_POST_VARS =& $_POST;

$HTTP_POST_FILES =& $_FILES;

$HTTP_SESSION_VARS =& $_SESSION;

 

Try adding that. Then it should work...

Adam

--------------------------------

got monkey? We do.

http://www.monkeygoods.com

Link to comment
Share on other sites

What version of PHP are you using? We recently upgraded to 3.4.1 ...

 

I think that was a typo from quick typing.

netcraft.com says your running PHP/4.3.1.

You may have the fix many of us upgrading to 4.3.1 want :D

 

Thanks in advance !!!

-ibandyop

ibandyop

Link to comment
Share on other sites

What version of PHP are you using? We recently upgraded to 3.4.1 ...

 

I think that was a typo from quick typing.

netcraft.com says your running PHP/4.3.1.

You may have the fix many of us upgrading to 4.3.1 want :D

 

Thanks in advance !!!

-ibandyop

 

to get ad tracker to run of PHP 4.3.1 just change the portion of application_top.php from this:

// Updated for PHP 3.4.x

//user_tracking modications

 if (!$referer_url) {

	 if ($HTTP_SERVER_VARS['HTTP_REFERER']) {

   $referer_url = $HTTP_SERVER_VARS['HTTP_REFERER'];

   tep_session_register('referer_url');

}

 }



//user_ad_tracker modification

 if ($ad) {

     $advertiser = $_GET["ad"];  

     tep_session_register('advertiser');      

  }

 

to this:

// ad tracking

 if (!$advertiser) {

     $advertiser = $_GET["ad"];

 if ($advertiser) {

     tep_session_register('advertiser'); 

 }

  }



// user_tracking modifications 

  if (!$referer_url) { 

   $referer_url = $_SERVER['HTTP_REFERER'];

   if ($referer_url) {

     tep_session_register('referer_url');

   }

 }

 

and you're in business

The only thing necessary for evil to flourish is for good men to do nothing

- Edmund Burke

Link to comment
Share on other sites

I'm not sure mine is working perfect it is getting some results, but I think it should be more. We advertise on google big style, and get lots of sales from it (or so I thought).

 

Can you tell me roughly how it works, is it right that the referring id that I have added for google, disappears if you got another page like create account etc.

 

In the instructions it say to track members coming from ads, i assume this means it catches new members who buy. Does it catch a new member that comes back later and buy or what?

 

Sorry if i'm being a little thick. :oops:

 

BTW great contribution....Especially from someone who calls themselves a php newbie what does that make me???

 

Nev

Link to comment
Share on other sites

Hi All, I have implemented all this contribution and am getting the following error in the registration process - Parse error: parse error in /var/www/html/catalog/create_account_process.php on line 264. Line 264 happens to coincide with 'customers_advertiser' => $advertiser,

 

For us, this would be one of the most important contributions and we would be eternally greatful for any help ANYONE can offer. We are running 2.2MS1 and PHP 4.1.1. You can visit our development site at www.laptops-battery.com. Thanks again for ANY and ALL help....

Jason

Link to comment
Share on other sites

Sorry for the late reply. For some reason I wasn't getting post notifications on this thread.

 

Anyway, sorry for the minor bout of dyslexia with the version number. It is, in fact, 4.3.1 as ibandyop pointed out. I also have to admit that my experience with PHP is still relatively new and mostly resigned to hacking existing code. However, I'll do my best to try and resolve the problems you guys have been having.

 

I don't believe this contrib works with search engine safe URLS. However, I'd be happy to add that in the next update. I'm just not sure how. :oops:

 

To singspiel's question, because the value is getting set in application_top, it shouldn't matter what page you send your visitors to. When I was testing this I clicked through to various pages and created orders both from new and existing customer accounts. Both seemed to work fine.

 

Please note that the ad referral code (?ad=google) is saved to the user table NOT to the order table. This means that a returning customer's purchase will continue to add value under whatever ad code they came in with. This made sense to me since I still credit the ad with having brought me the customer in the first place AND I wanted to know about customers who came in didn't buy anything the first time but returned later.

 

So, per your question, if a customer comes in through an ad, registers for an account but doesn't buy something the system will still capture the ad referral code. All future purchases by that customer will then show up as having originated from whatever ad they came in on.

 

Finally, thank you dreamscape for the update. If that's working for everyone, I'll be sure to include it in the next upload.

Adam

--------------------------------

got monkey? We do.

http://www.monkeygoods.com

Link to comment
Share on other sites

I seem to be running into the same issue above and have tried all of the suggested fixes. I'm not sure if twocom got it working but here's my problem (at least one of them :shock:

 

I have installed the contribution but the results don't seem to be coming through. I have tried both safe and unsafe urls. Looking in the db, neither field seems to update (customers_advertiser or customers_referer_url) with either new or existing customers. I've tried everything I know to how.

 

I've installed quite a few contributions and haven't had any problems up to this point so hopefully someone can get me straightened out. Again, I'm using 2.2MS1 and php 4.1.1. My dev site can be viewed at www.laptops-battery.com. Thanks for ANY and ALL help.

Link to comment
Share on other sites

I want to thank Adam for this fantastic code and ALSO explaining

how he thinks it should work - I think it is a brilliant idea. Now I am even more motivated to get this code working !

 

I don't believe this contrib works with search engine safe URLS.  However, I'd be happy to add that in the next update.  I'm just not sure how. :oops:

 

When I get home tonight, I will look into getting the search engine safe urls to work.

ibandyop

Link to comment
Share on other sites

  • 2 weeks later...

Has anyone got this working yet? I'm still having the same problem where i can't get any results to show. I would really appreciate any help anyone can offer. I'm running 2.2MS1 and have php 4.1.1. Can anyone help or give feedback on if they have it working partially or fully? Thanks!

Link to comment
Share on other sites

  • 3 months later...
  • 5 months later...

//use this #5 instead of #5 in contribution to use contrib with MS2 (works on my setup)

 

5. UPDATE /catalog/create_account.php (create_account_process.php has been depreciated)----------------------------------------

 

Change THIS (around line 250):

 

 

$sql_data_array = array('customers_firstname' => $firstname,

'customers_lastname' => $lastname,

'customers_email_address' => $email_address,

'customers_telephone' => $telephone,

'customers_fax' => $fax,

'customers_newsletter' => $newsletter,

'customers_password' => tep_encrypt_password($password));

 

To THIS:

 

$sql_data_array = array('customers_firstname' => $firstname,

'customers_lastname' => $lastname,

'customers_email_address' => $email_address,

'customers_telephone' => $telephone,

'customers_fax' => $fax,

'customers_newsletter' => $newsletter,

'customers_password' => tep_encrypt_password($password),

'customers_advertiser' => $advertiser,

'customers_referer_url' => $referer_url);

 

 

 

 

 

any questions, let me know. I also hacked a quick add on so the referring url is displayed with along with the Ad source in the customer list in the admin

 

//this code displays the referring url in customer list in admin area

 

//add to admin/includes/english/customers.php

 

define('TABLE_HEADING_REFURL', 'Ref. URL');

 

 

 

 

//alter admin/customers.php

 

//after this line

<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_AD; ?></td>

 

//add this string

<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_REFURL; ?></td>

 

 

//change this line

 

$customers_query_raw = "select c.customers_id, c.customers_lastname, c.customers_firstname, c.customers_email_address, a.entry_country_id, c.customers_advertiser from " . TABLE_CUSTOMERS . " c left join " . TABLE_ADDRESS_BOOK . " a on c.customers_id = a.customers_id and c.customers_default_address_id = a.address_book_id " . $search . " order by c.customers_lastname, c.customers_firstname";

 

//to this (change is adding c.customers_referer_url)

$customers_query_raw = "select c.customers_id, c.customers_lastname, c.customers_firstname, c.customers_email_address, a.entry_country_id, c.customers_advertiser, c.customers_referer_url from " . TABLE_CUSTOMERS . " c left join " . TABLE_ADDRESS_BOOK . " a on c.customers_id = a.customers_id and c.customers_default_address_id = a.address_book_id " . $search . " order by c.customers_lastname, c.customers_firstname";

 

 

 

//after this line

<td class="dataTableContent"><?php echo $customers['customers_advertiser']; ?></td>

 

//add this string

<td class="dataTableContent"><?php echo $customers['customers_referer_url']; ?></td>

 

 

ENJOY!

Link to comment
Share on other sites

thanks, looks like there is no more error for me in create_account, it looks smooth, however when i do www.example.com/index.php?ad=1212 it will show up, however in ad tracker (admin it will not show up.... does anyone know why???

maybe i did something wrong? i dont think i did but the ad tracker doesn't store the info! Let me know thatnks guys

josh!

Edited by jrconsultations
Link to comment
Share on other sites

ok one more thing that may be the problem, inthe database i noticed that both customer_refer_id and customer_advertiser were both NULL, so i changed that.. to not null, but still no luck, then i noticed that if i put the ad=test for example: www.mysite.com/catalog/index.php?ad=test after the user clicks somewhere else the ad=test does not stick to the link, could this be the problem nothing at all shows up on my ad reports?

Link to comment
Share on other sites

Join the conversation

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

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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...