Tracciare ordini provenienti da pubblicità

Postate qui discussioni di carattere generale riguardo a problemi di installazione e configurazione di osCommerce

Moderatore: mod Generali

Rispondi
cirieh
membro Baby
membro Baby
Messaggi: 93
Iscritto il: 01/10/2003, 0:00
Località: USA
Contatta:

Tracciare ordini provenienti da pubblicità

Messaggio da cirieh »

salve,
da un paio di mesi uso le google adwords ed altri tipi di sponsorizzazione.
ora visto che le spese aumentano vorrei poter sapere quale ordine(cliente che ordina) proviene da una o dall'altra.Per il momento ho brancolato nel buio del marketing.

ho provato la seguente contrib solo che non mi funziona la fase della somma degli ordini per ref-id(forse xchè è stato fatto per il osc 2.2??):

Codice: Seleziona tutto

---------------------------
OSC Commerce 2.2
Ad Link Tracking
Written by Adam Safran
asafran@amonkey.com
http://www.monkeygoods.com/
Written December 14, 2002

Updated April 27, 2003
Added Admin section reporting and updated for PHP 3.4.x
---------------------------

1. Intro -----------------------------------------------------------------------

I was desperately trying to find a way to track the various ad campaigns I was
running for my new store, monkeygoods.com.

This modification allows you to keep track of where your registered users are coming from.
For anyone running multiple ad banners or paid google-type links, knowing which ads are 
effective is pretty nice.

In addition, I wanted to capture the entire referring url so I could later see what the
users search string was to get to my link.

2.  Caution: Newbie Alert---------------------------------------------------------------

While I currently have this modification running on my production server, I must warn you
that I am a PHP newbie.  You should probably back up any affected files.

3. Update the Customers table  ---------------------------------------------------------

ALTER table customers add customers_advertiser varchar(30);
ALTER table customers add customers_referer_url varchar(255);

4. UPDATE /catalog/includes/application_top.php ----------------------------------------

Add the following
Place AFTER "tep_session_start();"

// 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');      
   } 

5. UPDATE /catalog/create_account_process.php ----------------------------------------

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' => crypt_password($password),
                            'customers_default_address_id' =>;
							
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' => crypt_password($password),
                            'customers_default_address_id' => 1,
							'customers_advertiser' => $advertiser,
                            'customers_referer_url' => $referer_url);

6. UPDATE /admin/customers.php ---------------------------------------------------------

I figured the customers view was the simplist place to see this info:

Around line 438:

AFTER THIS:
<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_LASTNAME; ?></td>
<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_FIRSTNAME; ?></td>

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

Around Line 449:

CHANGE THIS query:

$customers_query_raw = "select c.customers_id, c.customers_lastname, c.customers_firstname, c.customers_email_address, a.entry_country_id 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 (note: change is the addition of "c.customers_advertiser" to select):
$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";

Around Line 447:

AFTER THIS:
<td class="dataTableContent"><?php echo $customers['customers_lastname']; ?></td>
<td class="dataTableContent"><?php echo $customers['customers_firstname']; ?></td>

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


7. UPDATE /admin/includes/languages/english/customers.php ---------------------------------------

Add:
define('TABLE_HEADING_AD', 'Ad');

8. ADD FILES To Admin --------------------------------------------------------

/admin/stats_ad_results.php
/admin/includes/languages/enlgish/stats_ad_results.php

9. Add to /admin/includes/application_top.php ---------------------------------

define('FILENAME_STATS_AD_RESULTS', 'stats_ad_results.php');

10. Add to /admin/includes/languages/english.php -------------------------------

define('BOX_REPORTS_AD_RESULTS', 'Ad Results');

11. Add to /admin/includes/boxes/reports ----------------------------------------

'<a href="' . tep_href_link(FILENAME_STATS_AD_RESULTS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_AD_RESULTS . '</a><br>' .

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

That's pretty much it.

Now, when you post your ads or links to your site, just include the variable "ad" in your querystring.

Examples:
http://www.monkeygoods.com/default.php?ad=google.hats
http://www.monkeygoods.com/default.php?ad=joe

You can then go to the "Ad Results" report and see a breakdown of all revenue generated by those ads.
In addition, you can enter a start date.  I'll be adding a date range next.  For now the data pulls from 
the start date to today.  If no date is entered, all add results are queried

While I'm capturing the referal_url as well, I didn't take the time to add it to the admin.  Anyone?
funziona la parte dell'acquisizione del ref-id inquanto tra la lista dei clienti viene creata una colonna apposita dove compare il ref id di provenienza, ma nella sezione report non mi trova alcuna transazione generata.
Chi mi aiuta?
toy-modellismo
membro Junior
membro Junior
Messaggi: 16
Iscritto il: 07/04/2006, 12:27
Contatta:

Messaggio da toy-modellismo »

Anche io, ho lo stesso problema
Tu hai risolto ?
www.toy-modellismo.it
Vendita di elicotteri elettrici radiocomandati Esky, ricambi ed accessori.
Rispondi