Jump to content

Using Conversion Tracking


DimaK

Recommended Posts

  • Replies 63
  • Created
  • Last Reply

Top Posters In This Topic

  • WHMCS CEO

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • WHMCS CEO

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

Link to comment
Share on other sites

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}

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 2 weeks later...
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?

Link to comment
Share on other sites

  • 2 months later...
  • 2 months later...

Join the conversation

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

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

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated