Reputation: 309
I'm doing some conversion and revenue tracking using Virtual Website Optimizer. To track revenues, they instruct you to add a piece of Javascript code on the thank you page to determine the actual revenue earned.
<script type="text/javascript">
var _vis_opt_revenue = 0;
//zero should be replaced by the actual revenue figure
</script>
I'm using a Wufoo form and made it so that I can add a URL parameter that totals up their order, so for example if their order has a total of $280 they'll be sent to:
http://mysite.com/thank-you?total=280
I'm wondering: how can I make it so that URL parameter is inserted into the Javascript tracking code from Visual Website Optimizer?
Thanks in advance.
Upvotes: 0
Views: 581
Reputation: 19591
Try this
var _vis_opt_revenue =
'$' + window.location.pathname.split('?')[1].split('=')[1];
Upvotes: 0
Reputation: 222040
Function taken from here
Add this
function getParameterByName(name)
{
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regexS = "[\\?&]" + name + "=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(window.location.search);
if(results == null)
return "";
else
return decodeURIComponent(results[1].replace(/\+/g, " "));
}
Then change
var _vis_opt_revenue = 0;
to
var _vis_opt_revenue = getParameterByName("total");
Upvotes: 3