Adding Google Adword Conversion Tracking to Perl Form - Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Webmaster Tech > Programming > Other Programming - Perl, C++, Java, ASP, .NET Development

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 03-06-2009, 11:26 AM   #1 (permalink)
Junior Member
 
Join Date: Mar 2009
Posts: 3
Default Adding Google Adword Conversion Tracking to Perl Form

We had our form completed by a company that no longer supports Perl and I need to get my form updated with the Google Adwords Conversion Tracking Code. I followed the directions provided by Google, but they aren't helpful since the form is in Perl. Below, I will post the code to be added and my form. Can anyone assist me with how to include the code? Thank you.



The Google Adwords Conversion Tracking Code that needs to be entered into my Perl form is:

<!-- Google Code for TBI Programs Conversion Page -->
<script language="JavaScript" type="text/javascript">
<!--
var google_conversion_id = 1071331077;
var google_conversion_language = "en_US";
var google_conversion_format = "2";
var google_conversion_color = "ffffff";
var google_conversion_label = "X8IuCPecZxCF7uz-Aw";
//-->
</script>
<script language="JavaScript"

src="http://www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<img height="1" width="1" border="0"

src="http://www.googleadservices.com/pagead/conversion/1071331077/?label=X8IuCP

ecZxCF7uz-Aw&amp;guid=ON&amp;script=0"/>
</noscript>




My Form Code is:

#!c:/perl/bin/Perl.exe
##
## emailFormData.pl -- Sends form data to email recipient(s) listed in hidden

form field emailto
## Expects to

receive two form params: formname, emailto
## formname

- self explanatory, the name of the form
## emailto

- a comma separated list of email addresses
##

can be as little as one or multiple email addresses
##

examples:
##

SomeEmail@somedomain
##

SomeEmail@somedomain.com,SomeEmail@somedomain.com
##

use strict;
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
use Net::SMTP;

my $query = new CGI;

my $formname = param('formname');
my $emailfrom = param('emailfrom');
my $emailto = param('emailto');
my $emailsubject = param('emailsubject');
my $print_debug_info = 'no';
my $sendEmail = 'yes';
my $error_message = '';
my $error = 0;

my ($var, $name, $value, $val);
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isd st) = localtime(time);
$year = $year + 1900;
$mon = $mon + 1;
my $today_date = $mon.'/'.$mday.'/'.$year;
my $ampm = ' am';
if ($hour > 12) {
$hour = $hour - 12;
$ampm = ' pm';
}
my $today_time;
if ($min < 10) {
$today_time = $hour.':0'.$min.$ampm;
} else {
$today_time = $hour.':'.$min.$ampm;
}

my @keywords = $query->keywords;
my @names = $query->param;

print $query->header(-expires=>'now');
print $query->start_html(-title=>'Email Form Data');

my $emailText = '';
my $displayText = '<b>requestor_IP : </b>'.$ENV{'REMOTE_ADDR'}.'<br>'.
'<b>script_name :

</b>'.$ENV{SCRIPT_NAME}.'<br>';
my $kntr = 0;
foreach my $name (@names) {
if ( lc($name) ne 'submit' ) {
if ( lc(param($name)) eq 'checkbox') {
$emailText .= $name.': CHECKED'."\n";
$displayText .= '<b>'.$name.'</b>:

'.param($name).'<br>';
} else {
$emailText .= $name.': '.param($name)."\n";
$displayText .= '<b>'.$name.'</b>:

'.param($name).'<br>';
}
}
$kntr++;
}
$emailText =~ s/_/ /g; ## Replace underscores with spaces
$displayText =~ s/_/ /g; ## Replace underscores with spaces
$emailText =~ s/checkbox/Yes/g; ## Replace word checkbox with Yes
$displayText =~ s/checkbox/Yes/g; ## Replace word checkbox with Yes


if ( $print_debug_info eq 'yes' ) {
print $query->Dump;
print '<h4>'.$displayText.'</h4>';
}

my @distList = split(",", $emailto );
if ( $sendEmail eq 'yes' ) {
foreach my $sendTo ( @distList ) {
#print "<h4> email sent to $sendTo".'</h4>';
Send_Email($emailfrom, $sendTo, $emailsubject, $emailText);
}
print qq!<h4>
Thank you.<br>

Your request has been submitted and a

Teambuildinginc.com
consultant will contact you within 2 business

days to provide you with a proposal based on your situation and needs. <br>
To return to the Teambuildinginc.com site: <a

href="http://www.teambuildinginc.com">Click Here</a> </h4>!;
}
print $query->end_html;
exit;


###########################################
sub Send_Email() {
my ($MailFrom, $MailTo, $Subject, $Body, $ServerName) = ( @_ );

my $testonly = 1;

if ($MailFrom eq '') { $MailFrom = 'inquire@teambuildinginc.com'; }
if ($MailTo eq '') { $MailTo = 'inquire@teambuildinginc.com'; }
if ($Subject eq '') { $Subject = "Subject"; }
if ($Body eq '') { $Body = "Body"; }


if ($testonly == 1) {
$Subject = $Subject;
}

if ($ServerName eq '') { $ServerName = "localhost"; }

# Create a new SMTP object
my $smtp = Net::SMTP->new($ServerName);

# If you can't connect, don't proceed with the rest of the script
die "Couldn't connect to server" unless $smtp;

$smtp->mail( $MailFrom );
$smtp->to( $MailTo );
$smtp->data();

# Send the header
# This address will appear in the message
$smtp->datasend('To: '.$MailTo."\n");

# So will this one
$smtp->datasend('From: '.$MailFrom."\n");
$smtp->datasend("Subject: $Subject\n");
$smtp->datasend("\n");

# Send the Body.
$smtp->datasend("$Body\n\n");

# Send the termination string
$smtp->dataend();

# Close the connection
$smtp->quit();
}
CAP_TBP is offline   Reply With Quote
Sponsored Links
Old 07-03-2011, 10:50 PM   #2 (permalink)
Junior Member
 
Join Date: Jul 2011
Posts: 1
Default Re: Adding Google Adword Conversion Tracking to Perl Form

Did you ever figure this out as I have the same problem?
dlooke is offline   Reply With Quote
Old 07-05-2011, 09:37 AM   #3 (permalink)
Junior Member
 
Join Date: Mar 2009
Posts: 3
Default Re: Adding Google Adword Conversion Tracking to Perl Form

Never solved the problem. We ended up changing formats and no longer use Perl.
CAP_TBP is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Sponsors

» Links

» Affiliates
Web Hosting
Online Backup Reviews
Marketing Find
Merchant Select
SiteMap Builder
Host Compare

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 06:37 PM.


Powered by vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.2
Webmaster Forums
Web Hosting | Chicago Web Hosting | Web Hosting