View Full Version : Using Conversion Tracking
Was announced in V3.6 that it will work with Google Conversion Tracking. How do you use it?
outhost
02-12-08, 12:00 PM
yeah have been looking for this myself
templates/orderforms/cart/complete.tpl is the file. There is a section in there:
{if $ispaid}
<!-- Enter any HTML code which needs to be displayed once a user has completed the checkout of their order here - for example conversion tracking and affiliate tracking scripts -->
{/if}
The HTML code you place there only runs once the user has paid and fully completed the order process.
Matt
In your example it's for "/cart/"
Will it work with /singlepage/order-complete.tpl ?
Or even if I use "/singlepage/" I have to add tracking code to /cart/complete.tpl ?
Will this code runs always or we have to enable it in "GENERAL SETTINGS" ?
(for example "Auto Redirect on Checkout" I use "automatically redirect the user to the invoice", will it work for me?
What variables can we use for tracking codes?
like payment amount, domain name, invoice num etc.
I have tested,
and for "/singlepage/" we can add tracking code to /cart/complete.tpl
without additional settings,
But it's not work with Braces {, } in the tracking codes.
And still question how to add payment sum ?
oh,
"Just need to enclose it in {literal} and {/literal} ..."
and it works :)
tracktor
02-12-08, 03:47 PM
Hi Dimak,
the code in complete.tpl work with "Auto Redirect on Checkout"??
regards
No matter what checkout option is used, the order process will now always end on the order complete page once paid for - that was the new feature.
Matt
D9Hosting
02-13-08, 10:45 AM
Does anyone know what variables are available to use on this page? I'm sure there is a Smarty command you can use that will show the variables that are available for you, but my mind has gone blank :roll:
I'm not sure, but I think it's {debug} - i've seen it posted around a lot here.
D9Hosting
02-13-08, 02:39 PM
Cheers, That's it :-P
I've got a list of variables here, one thing that's missing is the order total, which would be very useful for Google Analytics, would this be possible to include Matt?
Here's the list for the rest of you, I'm copy/pasting straight from the debug console so lets see how it comes out....
{$SCRIPT_NAME} /clients/cart.php
{$breadcrumbnav} <a href="cart.php">Shopping Cart</a>
{$charset} iso-8859-1
{$clientsdetails} Array (3)
id => 152
firstname => Dan
lastname => Thompson
{$companyname} D9 Hosting
{$currency} USD
{$currencysymbol} $
{$invoiceid} empty
{$ispaid} empty
{$langchange} true
{$language} English
{$loggedin} true
{$orderid} 160
{$ordernumber} 7939606241
{$pageicon} images/support/order.gif
{$pagetitle} Shopping Cart
{$setlanguage} <form method="post" action="/clients/...
{$systemsslurl} empty
{$systemurl} http://www.d9hosting.com/clients
{$template} d9hosting
{$todaysdate} Wednesday, 13th February 2008
Odd... shouldn't $invoiceid and $ispaid not be empty after the person has paid? Or did you get his from a different step?
D9Hosting
02-13-08, 09:05 PM
I paid with credit rather than a standard gateway if that makes any difference?
I'll do another check tomorrow using a normal gateway and see what the results are.
If you need the total amount the order was for then you would use a code block like the below one to assign the {$amount} variable for use elsewhere in the template
{php}
$orderid = $this->get_template_vars('orderid');
$result = select_query("tblorders","amount",array("id"=>$orderid));
$data = mysql_fetch_array($result);
$amount = $data["amount"];
$this->assign('amount',$amount);
{/php}
So that would then enable you to do something like this in your tracking code:
<img src="http://order-tracker.com/?ordernumber={$orderid}&amount={$amount}" width="1" height="1" border="0" />
Matt
D9Hosting
02-14-08, 01:24 PM
Cheers Matt,
That looks like it should do the trick :)
allynne
02-16-08, 02:17 PM
Matt, would the following also work?
{php}
$orderid = $smarty->get_template_vars('orderid');
$result = select_query("tblorders","amount",array("id"=>$orderid));
$data = mysql_fetch_array($result);
$amount = $data["amount"];
$this->assign('amount',$amount);
$clientid = $smarty->get_template_vars('clientsdetails.id');
$result = select_query("tblclients","city,state,country",array("id"=>$clientid));
$data = mysql_fetch_array($result);
$this->assign('city',$data["city"]);
$this->assign('state',$data["state"]);
$this->assign('country',$data["country"]);
{/php}
simplehelix
02-18-08, 06:30 AM
I have placed the code for sharesale (basically an img tag) in the orderforms/cart/complete.tpl but it's not working for me.
i do a view source on it and it seems to be different from the complete.tpl file.
for instance, at the end, it supposed to show:
<p align="center"><a href="clientarea.php">{$LANG.ordergotoclientarea}</a></p>
but that is not anywhere in the view source of the page: cart.php?a=complete
am i doing something wrong?
btw im using 3.6.
i also using a different template for frontend but i think it would still use orderforms/cart/complete.tpl no?
can someone please help me out?
simplehelix
02-18-08, 06:34 AM
Ok I've just done another test and found out that it is indeed loading the complete.tpl
However!
Even after sucessfully paying with a credit card, it seems to me that:
{if $ispaid} ... {/if} block is not being triggered at all.
Why could this be?
Anyone else have the same problem?
I am in a limbo here. someone help me out.
THanks.
simplehelix
02-18-08, 06:40 AM
Now I've done more tests and i found a bug.
// doing this will not echo hi
{php}
$orderid = $smarty->get_template_vars('orderid');
echo "hi";
{/php}
// But doing this WILL echo hi
{php}
echo "hi";
$orderid = $smarty->get_template_vars('orderid');
{/php}
can someone please confirm this?
Matt, can you please give me your take on this?
Thanks.
Yes, with code:
------------
{php}
$orderid = $smarty->get_template_vars('orderid');
$result = select_query("tblorders","amount",array("id"=>$orderid));
$data = mysql_fetch_array($result);
$amount = $data["amount"];
$this->assign('amount',$amount);
{/php}
------------
it's not work correctly...not show {if $ispaid} block
Tech Entrance
02-22-08, 09:19 AM
I'm waiting to get a final working code out of this thread
NextLevel
02-24-08, 01:14 PM
I'm using Pro Rata billing. Using {$amount} just gives me the first payment amount rather than the total product monthly amount. Anyway of changing this or querying another table?
If you need the total amount the order was for then you would use a code block like the below one to assign the {$amount} variable for use elsewhere in the template
{php}
$orderid = $this->get_template_vars('orderid');
$result = select_query("tblorders","amount",array("id"=>$orderid));
$data = mysql_fetch_array($result);
$amount = $data["amount"];
$this->assign('amount',$amount);
{/php}
So that would then enable you to do something like this in your tracking code:
<img src="http://order-tracker.com/?ordernumber={$orderid}&amount={$amount}" width="1" height="1" border="0" />
Matt
No matter what checkout option is used, the order process will now always end on the order complete page once paid for - that was the new feature.
Matt
Do we need any special settings in WorldPay or will this script get called no matter what happens after the customer goes off to WorldPay to complete payment?
landexcorp
05-23-08, 08:38 AM
I tried to make this work, with out success. Is it possible they could integrate right into the code as an optional feature? Quite a bit of other software has that.
ksstudio
08-09-08, 02:39 AM
What if client didn't pay on the spot, such as they select other offline payment method?
Getting Google Analytics working is crucial to us, but nothing seems to work. Anybody out there got this working correctly?
This is a PITA.... But....
I *think* I've got it working correctly. I have it working for a $0.00 item, but there are a few tweaks that I had to make.
First, you *cannot* auto-redirect the user to either the invoice or gateway.
Your tracking code may fire *before* the user pays. If a user pays with PayPal they never go (back) to the order complete screen. I don't know about others.
My code ended up having to walk the invoice items via a DB call to get the details needed for the Google tracker. It looks good on paper, now I'm going to give it a bit and see if/how it works.... more later.
Edit: Also, keep in mind this doesn't track recurring payments at all. (I.E. WHMCS generates an invoice and they come back to pay it.)
Ok, I'm willing to let this code out a bit for others to test. If you're interested please PM me.
Anybody got Google Analytics / Converstion tracking working successfully?
Inetbiz
03-01-09, 01:00 PM
If you need the total amount the order was for then you would use a code block like the below one to assign the {$amount} variable for use elsewhere in the template
{php}
$orderid = $this->get_template_vars('orderid');
$result = select_query("tblorders","amount",array("id"=>$orderid));
$data = mysql_fetch_array($result);
$amount = $data["amount"];
$this->assign('amount',$amount);
{/php}
So that would then enable you to do something like this in your tracking code:
<img src="http://order-tracker.com/?ordernumber={$orderid}&amount={$amount}" width="1" height="1" border="0" />
Matt
Now what about paypal where they may not be redirected back to order complete? Do something in paypal IPN?
paradoxic
04-20-09, 06:09 PM
Has anyone got a complete solution for this?
do I also have problems with it, someone decided a question?
Yes, I don't understand why developer don't want to show it in Documentations...
You can place tracking code to
templates/orderforms/default/complete.tpl
(if you are using "default" order form)
==========================
{if $ispaid}
{literal}
<!-- Google Code for Purchase Conversion Page -->
<script language="JavaScript" type="text/javascript">
<!--
var google_conversion_id = 12313131313;
var google_conversion_language = "en_US";
var google_conversion_format = "1";
var google_conversion_color = "666666";
if (1.0) {
{/literal}
var google_conversion_value = {$amount};
{literal}
}
var google_conversion_label = "Purchase";
//-->
</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/12313131313/?value=1.0&label=Purchase&script=0">
</noscript>
{/literal}
{/if}
===============================
mediademon
06-19-09, 04:25 PM
Hi Dimak
Thanks for the code!
Don't you also need to post the amount for noscript?
{/literal}
<img height=1 width=1 border=0 src="http://www.googleadservices.com/pagead/conversion/12313131313/?value={$amount}&label=Purchase&script=0">
{literal}
raj@sbglobal.info
06-23-09, 04:40 PM
its very helpful for us.
annomander
07-23-09, 11:14 PM
I put the code thats in the whmcs wiki into the complete.tpl in the cart template
I made two different goals in google just be on the safe side
/complete.php
and
cart.php?a=complete
and nothing happened?
What am I missing?
Cheers
Inetbiz
08-08-09, 04:23 PM
Any updates on this?
juhogrey
08-14-09, 07:15 AM
I have the same issue.
Would be great to have a complete tutorial on how to do this.
Yep its a major problem for us too not being able to integrate with Google Analytics. Would be great to get a proper solution.
paradoxic
09-08-09, 10:33 PM
If anyone out there can help with this, it would be much appreciated.
Can we get an official response from Matt on this? This should be a built in feature, but if not, some final code posted as the wiki code doesn't seem to work.
chrissts
11-10-09, 11:13 AM
i didn't have any idea about this. thanks for sharing this with us.
bump, Anyone got a final solutions for google analytics?
Any update on this? With no response from WHMCS I'm assuming they either dont care or don't have an answer. The wiki information on this topic is very basic and not very good either.
I'm testing something out now but a definite answer would be helpful because it takes a few days to collect data and be able to tell if its working.
It is odd - its a very important aspect thats not working, but it seems nobody has any answers yet.
You'll have to remove {if $ispaid} so Google can check your page. Mine said "Unverified" for months until I removed that.
It's not ideal, but it's better than no tracking at all.
{if $ispaid}
<!-- Enter any HTML code which needs to be displayed once a user has completed the checkout of their order here - for example conversion tracking and affiliate tracking scripts -->
{/if}
Is this still what we'd use to track conversions, or have things changed over the past 2 years?
hostnine
05-09-10, 10:52 PM
We're receiving inaccurate results all over the place.
We want to add all of our tracking pixels to where they're executed before the payment redirect.
Basically, once the user checks the box to agree to the TOS and clicks Submit it then executes all of our tracking pixels etc regardless of payment. We can write scripts to go through and validate valid conversions later. This current setup is just too unreliable as people will pay with paypal and not come back to the complete page. Some people pay via credit card later on and don't see the complete page as they login through /billing/ to do it etc
Is there any way this can be possible?
Has anybody got this working yet? We understand until Google implement some kind of PHP tracking code, its not going to be possible :(
ksstudio
05-11-10, 03:22 PM
We're receiving inaccurate results all over the place.
We want to add all of our tracking pixels to where they're executed before the payment redirect.
Basically, once the user checks the box to agree to the TOS and clicks Submit it then executes all of our tracking pixels etc regardless of payment. We can write scripts to go through and validate valid conversions later. This current setup is just too unreliable as people will pay with paypal and not come back to the complete page. Some people pay via credit card later on and don't see the complete page as they login through /billing/ to do it etc
Is there any way this can be possible?
You may put your Google Conversion Tracking Code in complete.tpl and under settings, set " Just show the order completed page (no payment redirect)"
You may put your Google Conversion Tracking Code in complete.tpl and under settings, set " Just show the order completed page (no payment redirect)"
This is not a good solution because it doesnt take people on the natural path to payment... It stops them unnecessarily.
We need a solution which doesnt involve diverting people away from paying for their hosting right away.
hostnine
05-18-10, 05:00 AM
This is why we want the CC fields to be on the actual order form and no redirect to creditcard.php
http://forum.whmcs.com/showthread.php?t=29342
I have it working to the point where if someone lands on /cart.php?a=complete, it counts as 1 goal conversion. Haven't figured out how to send the $ amount to GA though. Is what the trouble is? Maybe if we clearly outline whats not working someone from WHMCS will answer.
I just wanted to chime in and say this is retarded that it doesn't work. We have tried about a dozen methods and nothing works with accuracy.
I'm looking forward to a WHCMS update that makes this possible. But for now I'm giving up,
Thanks, Ben
oempire
08-19-10, 01:55 PM
This is why we want the CC fields to be on the actual order form and no redirect to creditcard.php
http://forum.whmcs.com/showthread.php?t=29342
This feature is now in :) its going to make things easier for tracking!
Where? directions online? I've seen nothing to indicate this.
vBulletin® v3.8.4, Copyright ©2000-2010, Jelsoft Enterprises Ltd.