Page 1 of 1

Click Tracking code followup

PostPosted: Sun Feb 09, 2003 3:48 pm
by Steve Doherty
My original post seems to have disappeared. Strange, but here is my followup
question for Rob...

I used the Order API function as you suggested, and my tracking code worked,
except that the dollar amount did not did not come out correctly.

I wanted the code to end up in the ThankYou page like this

---------------------
<HTML><HEAD><TITLE>Thank you!</TITLE></HEAD><BODY><img
src="/cgi-bin/proanalyzer/action.cgi?action=sale&amount=118.99" width="1"
height="1"><!--
Content-type: text/html
---------------------

But, instead, it ended up in the Thank you page like this:
-------------------------
<HTML><HEAD><TITLE>Thank you!</TITLE></HEAD><BODY><img
src="/cgi-bin/proanalyzer/action.cgi?action=sale&amount=CGI=HASH(0x80fbb0c)-
param('F-ProductTotal')" width="1" height="1"><!--
Content-type: text/html

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

The code you wrote for me worked great, but not all the way. It did not put
the actual ProductTotal in there. I have a feeling I'm 95% of the way there.
What do you think I should change? Thanks very much for your help so far.



---------------
original message (has disappeared from this newsgroup)
----------------

You need to use the order API functionality of ShopSite to accomplish this.
This involves writing a cgi script that will output the correct code with
the order total included in the code.

The variable you will be interested in is:
F-ProductTotal : The total price of all products in the order, before any
discounts, surcharges, tax, and shipping.
http://www.shopsite.com/help/6.2/en-US/ ... r.api.html

Here is a simple perl script that outputs the total in the format you
described:
---
#!/usr/bin/perl

use CGI;

$var = new CGI;

print "Content-type: text/html\n\n";
print "<HTML><HEAD><TITLE>Thank you!</TITLE></HEAD><BODY>";

print "<img
src=\"/cgi-bin/pa/action.cgi?action=sale&amount=$var->param('F-ProductTotal'
)\" width=\"1\" height=\"1\">";

print "<!-- \n";
exit;
---

This little snippet will output the required img call with the Product Total
inserted in the correct location. This should help you get going in the
right direction.

Rob

Re: Click Tracking code followup

PostPosted: Sun Feb 09, 2003 4:15 pm
by Rob
Steve,

Not sure why it came out that way. Make sure the print statement is all on
one line in the perl script you have. If it is on 2 lines, it could cause it
to not output correctly.

Here is another variation you could try, which should work:
---
#!/usr/bin/perl

#-------------------------------------------
# READ IN DATA POSTED ON WEB

# Get the input
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});

# Split the name-value pairs
@pairs = split(/&/, $buffer);

foreach $pair (@pairs)
{
($name, $value) = split(/=/, $pair);

# Un-Webify plus signs and %-encoding
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;

# Uncomment for debugging purposes
# print "Setting $name to $value<P>";

$FORM{$name} = $value;
}
#-------------------------------------------

$total = $FORM{'F-ProductTotal'};

print "Content-type: text/html\n\n";
print "<HTML><HEAD><TITLE>Thank you!</TITLE></HEAD><BODY>";

print "<img src=\"/cgi-bin/pa/action.cgi?action=sale&amount=$total\"
width=\"1\" height=\"1\">";

print "<!-- \n";
exit;
---

Rob M.

"Steve Doherty" <sdoherty@mobileuniverse.com> wrote in message
news:b26ic1$5vm$1@support.shopsite.com...
-------------------------
HTML><HEAD><TITLE>Thank you!</TITLE></HEAD><BODY><img

src="/cgi-bin/proanalyzer/action.cgi?action=sale&amount=CGI=HASH(0x80fbb0c)-
param('F-ProductTotal')" width="1" height="1"><!--
Content-type: text/html
---------------

Re: Click Tracking code followup

PostPosted: Sun Feb 09, 2003 5:28 pm
by Steve Doherty
Rob,

Success! You are the Man! Thank you.

I did not break the print line into two lines on the first script. Don't
know why it did not work. But, this second script you wrote worked
perfectly. Thanks again!

Steve


"Rob" <rob@mangiafico.net> wrote in message
news:b26ju4$63d$1@support.shopsite.com...
Steve,

Not sure why it came out that way. Make sure the print statement is all on
one line in the perl script you have. If it is on 2 lines, it could cause
it
to not output correctly.

Here is another variation you could try, which should work:
---
#!/usr/bin/perl

#-------------------------------------------
# READ IN DATA POSTED ON WEB

# Get the input
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});

# Split the name-value pairs
@pairs = split(/&/, $buffer);

foreach $pair (@pairs)
{
($name, $value) = split(/=/, $pair);

# Un-Webify plus signs and %-encoding
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;

# Uncomment for debugging purposes
# print "Setting $name to $value<P>";

$FORM{$name} = $value;
}
#-------------------------------------------

$total = $FORM{'F-ProductTotal'};

print "Content-type: text/html\n\n";
print "<HTML><HEAD><TITLE>Thank you!</TITLE></HEAD><BODY>";

print "<img src=\"/cgi-bin/pa/action.cgi?action=sale&amount=$total\"
width=\"1\" height=\"1\">";

print "<!-- \n";
exit;
---

Rob M.

"Steve Doherty" <sdoherty@mobileuniverse.com> wrote in message
news:b26ic1$5vm$1@support.shopsite.com...
-------------------------
HTML><HEAD><TITLE>Thank you!</TITLE></HEAD><BODY><img


src="/cgi-bin/proanalyzer/action.cgi?action=sale&amount=CGI=HASH(0x80fbb0c)-
param('F-ProductTotal')" width="1" height="1"><!--
Content-type: text/html
---------------