News:

Support the VirtueMart project and become a member

Main Menu

Google Conversion Script Entry for Virtuemart 3

Started by batetim, May 15, 2015, 13:36:40 PM

Previous topic - Next topic

batetim

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

GJC Web Design

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
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

batetim

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.

GJC Web Design

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 ."
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation