VirtueMart Forum

VirtueMart 2 + 3 + 4 => Installation, Migration & Upgrade => Topic started by: batetim on May 15, 2015, 13:36:40 PM

Title: Google Conversion Script Entry for Virtuemart 3
Post by: batetim on May 15, 2015, 13:36:40 PM
Dear All

Have recently upgraded our site from Joomla 2 and virtuemart 2, to a Joomla 3.4.1 Virtuemart 3.0.8.

In the past we have added google conversion script in the following locations:

/templates/yourtemplate/html/com_virtuemart/cart/order_done.php
and
components/com_virtuemart/views/cart/tmpl/order_done.php

We had prevously inserted the script between

echo 'my google script';
echo $this->html;

However in this later version i notice these files differ from previously and am unsure where to place the script, if these are indeed still the correct locations?

Also i can see now there is both a

/templates/yourtemplate/html/com_virtuemart/cart
and
/templates/yourtemplate/html/com_virtuemart/carts

If anyone has successfully inserted a google conversion script on this latest virtuemart version i would appreciate some advice.

Kind regards

Tim
Title: Re: Google Conversion Script Entry for Virtuemart 3
Post by: GJC Web Design on May 15, 2015, 13:45:27 PM
it depends a bit on the payment plugin but generally the page you end up on is
components\com_virtuemart\views\cart\tmpl\order_done.php

but I notice e.g. in 3.0.8 paypal std. method the end page is

plugins\vmpayment\paypal\paypal\tmpl\stdresponse.php

there are others in the tmpl/ folder
Title: Re: Google Conversion Script Entry for Virtuemart 3
Post by: batetim on May 15, 2015, 17:16:13 PM
thanks GJC,

components\com_virtuemart\views\cart\tmpl\order_done.php looks to be the best bet.

We are using Media Street "Sagepay - Payment Gateway" plug in to our sagepay account.
Title: Re: Google Conversion Script Entry for Virtuemart 3
Post by: GJC Web Design on May 15, 2015, 17:55:05 PM
you can also send the js back in the $html  from the payment plug - normally in the  function plgVmOnPaymentResponseReceived(&$html)

add it something like  (this is the FB code)

$html .= "<!-- Facebook Conversion Code for xxxxxxxxx - Checkouts -->
<script>(function() {
var _fbq = window._fbq || (window._fbq = []);
if (!_fbq.loaded) {
var fbds = document.createElement('script');
fbds.async = true;
fbds.src = '//connect.facebook.net/en_US/fbds.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(fbds, s);
_fbq.loaded = true;
}
})();
window._fbq = window._fbq || [];
window._fbq.push(['track', '6xxxxxxxx', {'value':'".$payment->mc_gross."','currency':'AUD'}]);</script>\n
<noscript><img height='1' width='1' alt='' style='display:none'
src='https://www.facebook.com/tr?ev=6xxxxxxxxxxxx&amp;cd[value]='".$result->TotalAmount / 100 ."'&amp;cd[currency]=AUD&amp;noscript=1' /></noscript>\n
<!-- Facebook Conversion Code for xxxxxx - Checkouts -->\n
";


then you can get the conversion totals etc into the script .. e.g.  ".$result->TotalAmount / 100 ."