VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: adellaguardia on December 10, 2018, 00:23:06 AM

Title: Add Google Conversion Tracking to Head of Thank you page
Post by: adellaguardia on December 10, 2018, 00:23:06 AM
Hello,
I have been researching this with no resolution. I need to add a piece of Google code to the HEAD of the thank you page for VM to track conversions. I have created the order_done.php file in the template folder as needed for an override, but my script does not appear.
/templates/template_name/html/com_virtuemart/cart/order_done.php

I've added the script by itself above the php code, I've added it using:
$script = "script here";
$doc = JFactory::getDocument();
$doc->addScriptDeclaration( $script );

Nothing seems to work. Do I have to purchase an expensive plugin in order to track conversions? I only need the script on the thank you page in the HEAD section, not on every page.
Can you help?

Joomla 3.9.1
VM 3.4.2
Database Version 10.0.37-MariaDB
PHP Version 5.6.38 (working on getting this updated)
https://hospitalitylamps.com/
Title: Re: Add Google Conversion Tracking to Head of Thank you page
Post by: StefanSTS on December 10, 2018, 06:20:41 AM
Hello,

the order_done.php is now called orderdone.php.
Renaming the file should do the job, except you use a One Page Checkout that might use a different orderdone.php in it's own file structure.

Stefan
Title: Re: Add Google Conversion Tracking to Head of Thank you page
Post by: adellaguardia on December 12, 2018, 22:47:43 PM
That worked, thank you!
Title: Re: Add Google Conversion Tracking to Head of Thank you page
Post by: depika on December 17, 2018, 15:21:06 PM
It would be very helpful if you could share the script!! Or at list PM me the code. Thank you in advance