VirtueMart Forum

VirtueMart 2 + 3 + 4 => Security (https) / Performance / SEO, SEF, URLs => Topic started by: jaderotheram on June 28, 2013, 17:38:01 PM

Title: Google Adwords Conversion Tracking
Post by: jaderotheram on June 28, 2013, 17:38:01 PM
Virtuemart Version : 2.0.20a
Joomla Version : 2.5.9

I've read countless topics on this and there doesn't seem to be a straight answer to be found anywhere.

I have this code...

<!-- Google Code for Placed Order Conversion Page -->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = *IDNUMBER*;
var google_conversion_language = "en";
var google_conversion_format = "2";
var google_conversion_color = "ffffff";
var google_conversion_label = "dcRiCJaX8AQQ8sTh1wM";
var google_conversion_value = 0;
/* ]]> */
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/989356658/?value=0&amp;label=dcRiCJaX8AQQ8sTh1wM&amp;guid=ON&amp;script=0"/>
</div>
</noscript>

I want it to go on the page that says "Thank you for your Order, redirecting you to paypal (or whatever)"

I would like to know:

1) Where do I put this code? What File and what is the File Path for that File?
2) I understand you cant just put that script into a .php so what needs to be added to it?
3) Conversion Label?
4) Conversion Value? I would like the Conversion Value to be the Order Total, so what do I write for this?

Any Help would be greatly appreciated, as I'm sure it would be for a lot of people.
Title: Re: Google Adwords Conversion Tracking
Post by: mosdata on September 05, 2013, 14:07:22 PM
I have de same question. Any ideas?
Title: Re: Google Adwords Conversion Tracking
Post by: romatvirtue on September 07, 2013, 23:03:19 PM
Hi there. I have the same question. Although, my code is a facebook conversion tracking which should work the same way. I know that the best way to implement it in the order confirmation page. My problem is how do I properly insert the code?

I have currently implemented like this:

echo '<script type="javascript">
some variables...
</script>
<script language="javascript" src="https://www.facebook.com/xxxxxxxxxtracker.js">';


However, nothing is being captured.

Please help.

Thank you in advance.
Title: Re: Google Adwords Conversion Tracking
Post by: Maxim Pishnyak on September 08, 2013, 09:45:20 AM
Quote from: romatvirtue on September 07, 2013, 23:03:19 PM
I know that the best way to implement it in the order confirmation page.
Gold words!

What did you try to do actually?
Title: Re: Google Adwords Conversion Tracking
Post by: romatvirtue on September 08, 2013, 15:24:22 PM
Quote from: Maxim Pishnyak on September 08, 2013, 09:45:20 AM
Quote from: romatvirtue on September 07, 2013, 23:03:19 PM
I know that the best way to implement it in the order confirmation page.
Gold words!

What did you try to do actually?
Hi Maxim. Well, again, I have tried inserting the code just like in my example, but it's not capturing anything. I think I am not properly inserting it. Can you please help...?
Title: Re: Google Adwords Conversion Tracking
Post by: franzpeter on September 09, 2013, 10:27:15 AM
What about: order_done.php (components/com_virtuemart/views/cart/tmpl/order_done.php)?
Title: Re: Google Adwords Conversion Tracking
Post by: romatvirtue on September 09, 2013, 14:35:33 PM
Quote from: franzpeter on September 09, 2013, 10:27:15 AM
What about: order_done.php (components/com_virtuemart/views/cart/tmpl/order_done.php)?

What about it?
Title: Re: Google Adwords Conversion Tracking
Post by: romatvirtue on September 10, 2013, 02:33:16 AM
Quote from: Maxim Pishnyak on September 08, 2013, 09:45:20 AM
Quote from: romatvirtue on September 07, 2013, 23:03:19 PM
I know that the best way to implement it in the order confirmation page.
Gold words!

What did you try to do actually?

Hi Max, do you know how to properly insert the code?

Thanks.
Title: Re: Google Adwords Conversion Tracking
Post by: romatvirtue on September 11, 2013, 05:35:34 AM
Anyone, please? I really need to get the answer to this. Thanks. :(
Title: Re: Google Adwords Conversion Tracking
Post by: Maxim Pishnyak on September 15, 2013, 12:42:11 PM
You need to try and post here what you will get.
Title: Re: Google Adwords Conversion Tracking
Post by: franzpeter on September 15, 2013, 14:23:02 PM
Can someone tell me what Google Adwords Conversion Tracking does do? Do you pay Google by clicking on your advertisement or do you pay Google if someone clicks on your advertisement and finally buys something from your shop. So do you pay Google for successfully receiving an order or just directing a customer to your webshop?
Title: Re: Google Adwords Conversion Tracking
Post by: romatvirtue on September 16, 2013, 04:43:41 AM
Quote from: Maxim Pishnyak on September 15, 2013, 12:42:11 PM
You need to try and post here what you will get.
Hi Max, I am really lost. I don't know what your point is. I actually explained what I need. As far as conversion tracking, Google it. It's a common tracking tool that one can implement on the website.

I am not sure if you understand what I am looking for. :(

Thanks.
Title: Re: Google Adwords Conversion Tracking
Post by: Maxim Pishnyak on September 16, 2013, 05:22:30 AM
Quote from: franzpeter on September 15, 2013, 14:23:02 PM
Can someone tell me what Google Adwords Conversion Tracking does do? Do you pay Google by clicking on your advertisement or do you pay Google if someone clicks on your advertisement and finally buys something from your shop. So do you pay Google for successfully receiving an order or just directing a customer to your webshop?
We are working on buys/order option in this thread.
Quote from: romatvirtue on September 16, 2013, 04:43:41 AM
Quote from: Maxim Pishnyak on September 15, 2013, 12:42:11 PM
You need to try and post here what you will get.
Hi Max, I am really lost. I don't know what your point is. I actually explained what I need. As far as conversion tracking, Google it. It's a common tracking tool that one can implement on the website.
Quote from: Maxim Pishnyak on September 16, 2013, 04:48:26 AM
I need url to your web site and url to the page from where you got tracking codes.

Title: Re: Google Adwords Conversion Tracking
Post by: romatvirtue on September 16, 2013, 05:27:06 AM
Quote from: Maxim Pishnyak on September 16, 2013, 05:22:30 AM
Quote from: franzpeter on September 15, 2013, 14:23:02 PM
Can someone tell me what Google Adwords Conversion Tracking does do? Do you pay Google by clicking on your advertisement or do you pay Google if someone clicks on your advertisement and finally buys something from your shop. So do you pay Google for successfully receiving an order or just directing a customer to your webshop?
We are working on buys/order option in this thread.
Quote from: romatvirtue on September 16, 2013, 04:43:41 AM
Quote from: Maxim Pishnyak on September 15, 2013, 12:42:11 PM
You need to try and post here what you will get.
Hi Max, I am really lost. I don't know what your point is. I actually explained what I need. As far as conversion tracking, Google it. It's a common tracking tool that one can implement on the website.
Quote from: Maxim Pishnyak on September 16, 2013, 04:48:26 AM
I need url to your web site and url to the page from where you got tracking codes.

Hi Max,

I don't have a direct URL for the tracking as you have to sign in to your account to be able to generate the code. I am talking about facebook ad. So you have to create an add in your account and then they will give you a conversion tracking script.

As far as my website URL, you won't see if the code is loading unless you go through the checkout process. The reason is that it's inserted in order_done file.

Thanks for helping out and let me know if this helps.
Title: Re: Google Adwords Conversion Tracking
Post by: Maxim Pishnyak on September 16, 2013, 05:49:23 AM
Quote from: romatvirtue on September 16, 2013, 05:27:06 AM
1. I don't have a direct URL for the tracking as you have to sign in to your account to be able to generate the code. I am talking about facebook ad. So you have to create an add in your account and then they will give you a conversion tracking script.

2. As far as my website URL, you won't see if the code is loading unless you go through the checkout process. The reason is that it's inserted in order_done file.
1. I'm able to signup. Just give me the url. Also you could probably gather urls for tracking code instructions, can you?
2. Could you create copy of your website elsewhere with accessible for me checkout? Renew tracking codes for this place probably.
Title: Re: Google Adwords Conversion Tracking
Post by: romatvirtue on September 16, 2013, 06:25:19 AM
Quote from: Maxim Pishnyak on September 16, 2013, 05:49:23 AM
Quote from: romatvirtue on September 16, 2013, 05:27:06 AM
1. I don't have a direct URL for the tracking as you have to sign in to your account to be able to generate the code. I am talking about facebook ad. So you have to create an add in your account and then they will give you a conversion tracking script.

2. As far as my website URL, you won't see if the code is loading unless you go through the checkout process. The reason is that it's inserted in order_done file.
1. I'm able to signup. Just give me the url. Also you could probably gather urls for tracking code instructions, can you?
2. Could you create copy of your website elsewhere with accessible for me checkout? Renew tracking codes for this place probably.

Max, the facebook URL is this: https://www.facebook.com/ads/manage/convtrack.php?act=xxxxxxxxxxxxxxx. You would need to replace xxxxxxs with your account id. This is a facebook page.

As far as URL for the site, I'll send you the link in a moment. I turned on Sandbox for you to try if you wish. Once again, I appreciate all your help. Thanks.
Title: Re: Google Adwords Conversion Tracking
Post by: romatvirtue on September 19, 2013, 21:09:11 PM
Can someone else please help with this? How do I properly insert a conversion tracking JavaScript code into order confirmation page (order_done.php)? I am really surprised no one has done it, or doesn't know how to do it. VM is an E-Commerce platform. Don't you advertise with AdWords or Facebook or some other companies?

Please assist.

Thank you very much in advance.
Title: Re: Google Adwords Conversion Tracking
Post by: Maxim Pishnyak on September 22, 2013, 11:46:27 AM
Could you install a copy of your website somewhere (on subdomain etc).

You and me could make some test in a safe place with your test products.
Title: Re: Google Adwords Conversion Tracking
Post by: romatvirtue on September 23, 2013, 20:14:54 PM
Quote from: Maxim Pishnyak on September 16, 2013, 05:49:23 AM
Quote from: romatvirtue on September 16, 2013, 05:27:06 AM
1. I don't have a direct URL for the tracking as you have to sign in to your account to be able to generate the code. I am talking about facebook ad. So you have to create an add in your account and then they will give you a conversion tracking script.

2. As far as my website URL, you won't see if the code is loading unless you go through the checkout process. The reason is that it's inserted in order_done file.
1. I'm able to signup. Just give me the url. Also you could probably gather urls for tracking code instructions, can you?
2. Could you create copy of your website elsewhere with accessible for me checkout? Renew tracking codes for this place probably.

Hi Max. I sure can. I will do that and let you know once it's accessible. Just to let you know, I think the code is inserted properly. However, it's not capturing order information and that's why there is no conversion being tracked...
Title: Re: Google Adwords Conversion Tracking
Post by: romatvirtue on September 25, 2013, 00:22:49 AM
Quote from: Maxim Pishnyak on September 22, 2013, 11:46:27 AM
Could you install a copy of your website somewhere (on subdomain etc).

You and me could make some test in a safe place with your test products.

Hi Max, please use the credentials you got from the registration and try to buy the product. You should have no problem now. Again, the script load fine, but no conversion is being tracked. I am assuming it's because no product related info is loaded at the checkout.

Thank you.
Title: Re: Google Adwords Conversion Tracking
Post by: jjk on September 25, 2013, 21:05:10 PM
Quote from: romatvirtue on September 19, 2013, 21:09:11 PM
...I am really surprised no one has done it, or doesn't know how to do it. VM is an E-Commerce platform. Don't you advertise with AdWords or Facebook or some other companies?
Just in case you guys don't succeed, you might consider to use the free "Piwik" + free "Piwik plugin for VirtueMart" instead of Google Analytics. It allows to use conversion tracking, which is not limited to Google adwords. And it collects data in your own database instead of feeding Google databases - if you care about data privacy.

And no - I don't use AdWords (Instead I invest some time into free SEO) or Facebook for advertising. The fact that the majority of businesses invest a lot of time into facebook pages doesn't mean it's profitable.
Title: Re: Google Adwords Conversion Tracking
Post by: ATek on September 26, 2013, 09:47:02 AM
To answer the original poster's question.

Put a file on your website here -> /templates/Your Template/html/com_virtuemart/cart/order_done.php

The file to put above you should just copy file from components/com_virtuemart/views/cart/tmpl/order_done.php

Copy and past the Google Adwords Conversion code like this:

echo "<h3>".JText::_('COM_VIRTUEMART_CART_ORDERDONE_THANK_YOU')."</h3>";
echo 'YOUR GOOGLE CONVERSION CODE HERE';
echo $this->html;


Should work. Goodluck!
Title: Re: Google Adwords Conversion Tracking
Post by: romatvirtue on September 26, 2013, 16:02:22 PM
Quote from: ATek on September 26, 2013, 09:47:02 AM
To answer the original poster's question.

Put a file on your website here -> /templates/Your Template/html/com_virtuemart/cart/order_done.php

The file to put above you should just copy file from components/com_virtuemart/views/cart/tmpl/order_done.php

Copy and past the Google Adwords Conversion code like this:

echo "<h3>".JText::_('COM_VIRTUEMART_CART_ORDERDONE_THANK_YOU')."</h3>";
echo 'YOUR GOOGLE CONVERSION CODE HERE';
echo $this->html;


Should work. Goodluck!

Hi there. I appreciate you taking time to reply. That's exactly how I have inserted it. However, my client claims nothing is being captured...:(
Title: Re: Google Adwords Conversion Tracking
Post by: ATek on September 28, 2013, 06:29:13 AM
Quote from: romatvirtue on September 26, 2013, 16:02:22 PM
Hi there. I appreciate you taking time to reply. That's exactly how I have inserted it. However, my client claims nothing is being captured...:(
Maybe there is a problem with your override not working or the wrong folder.  Try editing both the original file and the override and see if anything changes.

When I pause the page right before it redirects to Paypal I can click view page source in Firefox and see the snippet of google code on the page.
Title: Re: Google Adwords Conversion Tracking
Post by: romatvirtue on October 04, 2013, 05:57:36 AM
Quote from: ATek on September 28, 2013, 06:29:13 AM
Quote from: romatvirtue on September 26, 2013, 16:02:22 PM
Hi there. I appreciate you taking time to reply. That's exactly how I have inserted it. However, my client claims nothing is being captured...:(
Maybe there is a problem with your override not working or the wrong folder.  Try editing both the original file and the override and see if anything changes.

When I pause the page right before it redirects to Paypal I can click view page source in Firefox and see the snippet of google code on the page.

Gotcha. Well, we use gateway. So on the confirmation page, I can see the code being loaded. Usually that means I did it right. Does this mean my client isn't properly testing it or something?

Thanks.
Title: Re: Google Adwords Conversion Tracking
Post by: ATek on October 10, 2013, 00:22:06 AM
Quote from: romatvirtue on October 04, 2013, 05:57:36 AM
Quote from: ATek on September 28, 2013, 06:29:13 AM
Quote from: romatvirtue on September 26, 2013, 16:02:22 PM
Hi there. I appreciate you taking time to reply. That's exactly how I have inserted it. However, my client claims nothing is being captured...:(
Maybe there is a problem with your override not working or the wrong folder.  Try editing both the original file and the override and see if anything changes.

When I pause the page right before it redirects to Paypal I can click view page source in Firefox and see the snippet of google code on the page.

Gotcha. Well, we use gateway. So on the confirmation page, I can see the code being loaded. Usually that means I did it right. Does this mean my client isn't properly testing it or something?

Thanks.

If you can see the code being loaded I would imagine it is working properly and Google should be confirming conversions, which you can confirm in your google adwords account.  You can test this easily by doing a mock product purchase and see whether the conversion is "reporting" after 15 minutes or so.  Unfortunately this is the extent of my knowledge on the process.
Title: Re: Google Adwords Conversion Tracking
Post by: logobis on November 28, 2013, 14:37:05 PM
Hi,

I'm user of Google ADWORDS and I confirm that the code should be implement in order_done.php (templates/YOUR_TEMPLATE/html/com_virtuemart/cart/order_done.php). IN my case, it's works perfectly even with 4 kinds of payments-> Paypal, Credit Card (ATOS), Check and Bank Transfer.
My Question here is how to improve the google code.

This line var google_conversion_value = 0; is to catch the order total amount of the transaction for ADWORDS analytics (and of course, improvement of your ROI....:)). Instead of "0" you'll have to put the value of the order.But I don't know how I could find the value (order total).Something like $this->order-total....???
Thank's for your help....
Title: Re: Google Adwords Conversion Tracking
Post by: microtribe on December 28, 2013, 01:40:35 AM
Logobis - Did you change the code based on Google's instructions for adding the conversion code to a php page? See below where I've copied in their instructions:


QuoteTo add conversion tracking code to PHP pages using your web page editor, look to the code below, then remove from your own code the lines that are crossed out, and manually add the areas that are highlighted

      
  <!-- Google Code for Purchase Conversion Page -->
  <script type="text/javascript">
  /* <![CDATA[ */
  var google_conversion_id = 1234567890;
  var google_conversion_language = "en_US";
  var google_conversion_format = "1";
  var google_conversion_color = "666666";
  var google_conversion_label = "Purchase";
  var google_conversion_value = 10;
  if (<? echo $totalValue ?>) {
  var google_conversion_value = <? echo $totalValue ?>
  }
  /* ]]> */
  </script>
  <script type="text/javascript"
  src="//www.googleadservices.com/pagead/conversion.js">
  </script>
  <noscript>
  <img height=1 width=1 border=0
  src="//www.googleadservices.com/pagead/
  conversion/1234567890/?value=
  <? echo $totalValue ?>&label=Purchase&script=0">
  </noscript>
  </body>
Open your conversion confirmation page PHP file. If multiple pages are generated from the same file, find the section in the PHP file which generates your conversion page.
If your site has a variable conversion value, determine the PHP expression that displays that value. For example: <?php echo $totalValue ?>, <? echo totalValue ?>
Choose the Purchase/Sale conversion type while going through the conversion tracking setup.
Enter a default numeric value in the "Conversion value" field, then replace the line "var google_conversion_value = ..." manually with the following
  if (<%= totalValue %) {
   var google_conversion_value = <%= totalValue %>;
   }
You'll also need to add replace the default numeric value with "<%= totalValue%>" in the <noscript> section of the tag highlighted above.
Copy and save the resulting code snippet.
Insert the conversion tracking code onto the conversion confirmation page. Make sure that the code appears within a static HTML section, not contained within an PHP code section (delineated by <? and ?> markers). As you insert the code snippet, make sure you place it directly into the body of the conversion confirmation page. To make sure you do, search for the </body> tag and place the code immediately above it. Or, if the </body> tag is not located within the static portion of the HTML page, make sure that you add the code snippet so that it appears within the <body> section of the page as shown below.
Save your conversion confirmation file and upload to your web server if necessary. If you'd like to test the placement of your conversion tracking code, go to your conversion page by completing a conversion on your site. View the source of the page (in Internet Explorer choose View > View Source). You should see the conversion tracking code between the <body> and </body> tags on your page. Note that the PHP expression will be replaced by the actual conversion value when you view the source.
Title: Re: Google Adwords Conversion Tracking
Post by: Peter Pillen on March 21, 2014, 16:30:59 PM
The file you need to change = components/com_virtuemart/views/cart/tmpl/order_done.php = thank you page after placing an order.

The code you need to add is the code you get from Google ... with two little changes to add the conversion value

var google_conversion_value = <?php echo $this->cart->pricesUnformatted['billTotal'] ?>;

and in the img src url ...?value=<?php echo $this->cart->pricesUnformatted['billTotal'] ?>....

Tip:
If you want to see which other values you can use, just write print_r($this->cart->pricesUnformatted); in the order_done file and you will see all other values you can use. Don't leave your file like that of course... otherwise customers wil get scared LOL

Also remember that it can take some time between the conversion itslef and the time you see in your Adwords account. But mine is working as it should now.

EDIT: components\com_virtuemart\views\pluginresponse\tmp l\default.php also needs to be adapted with the tracking code.
Title: Re: Google Adwords Conversion Tracking
Post by: oviliz on July 14, 2014, 12:24:08 PM
Gi Peter, can you please provide more details?

I made added the AdWords code at the end of my:
components/com_virtuemart/views/cart/tmpl/order_done.php
and
components\com_virtuemart\views\pluginresponse\tmp l\default.php

From the AdWords code, specific to my account, I changed only:
var google_conversion_value = 1.00;
with
var google_conversion_value = <?php echo $this->cart->pricesUnformatted['billTotal'] ?>;

I don't understand well the (same?) code about IMG src.

Anyway after that change the visitors confirmation orders are redirected to a blank cart/confirm.php page.
Title: Re: Google Adwords Conversion Tracking
Post by: oviliz on July 14, 2014, 17:25:50 PM
In the end I solved with that plugin, virtuemartrackingextension.com
Title: Re: Google Adwords Conversion Tracking
Post by: ITechnoDev on July 14, 2014, 17:59:03 PM
Quote from: oviliz on July 14, 2014, 12:24:08 PM
Gi Peter, can you please provide more details?

I made added the AdWords code at the end of my:
components/com_virtuemart/views/cart/tmpl/order_done.php
and
components\com_virtuemart\views\pluginresponse\tmp l\default.php

From the AdWords code, specific to my account, I changed only:
var google_conversion_value = 1.00;
with
var google_conversion_value = <?php echo $this->cart->pricesUnformatted['billTotal'] ?>;

I don't understand well the (same?) code about IMG src.

Anyway after that change the visitors confirmation orders are redirected to a blank cart/confirm.php page.

It means that there is a php error try to display the errors
Title: Re: Google Adwords Conversion Tracking
Post by: ITechnoDev on July 14, 2014, 18:18:13 PM
Quote from: oviliz on July 14, 2014, 17:25:50 PM
In the end I solved with that plugin, virtuemartrackingextension.com

one page checkout component also have this feature
Title: Re: Google Adwords Conversion Tracking
Post by: Peter Pillen on July 15, 2014, 16:28:26 PM
The code in the order-done file looks like this ... and this code needs to be placed in the different payment plugins that generate the "thank you for your order page". The google image url also needs part of the tracking code. It displays to the customer that google tracking is used. Depending per country you need to show this to the customers. If you don't need to show it - like me - give it a width and height of 1. In the code below the xxxxxxx stands for your google tracking id that is generated by google.

<?php

defined
('_JEXEC') or die('');

echo 
"<h3>".JText::_('COM_VIRTUEMART_CART_ORDERDONE_THANK_YOU')."</h3>";
echo 
"<p>".JText::_('COM_VIRTUEMART_CART_ORDERDONE_NOTICE')."</p>";
echo 
$this->html;

?>

<!-- Google Code for verkoop Conversion Page -->
<script type="text/javascript">
/* <![CDATA[ */
//enter your id number instead of the xxxxxx
var google_conversion_id = xxxxxxxxxx;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "Ze5ZCPmL-gcQ94LN3gM";
var google_conversion_value = <?php echo $this->cart->pricesUnformatted['billTotal'?>;
var google_remarketing_only = false;
/* ]]> */
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/xxxxxxxxxxxx/?value=<?php echo $this->cart->pricesUnformatted['billTotal'?>&amp;label=Ze5ZCPmL-gcQ94LN3gM&amp;guid=ON&amp;script=0"/>
</div>
</noscript>
Title: Re: Google Adwords Conversion Tracking
Post by: escozul on August 12, 2014, 22:38:34 PM
There are people who insist that the google tracking code needs to be placed before the echo $this->html; part of the original order_done.php

I guess that the code would become as so:

<?php
defined
('_JEXEC') or die('');
?>

<div class="order">
<?php
echo "<h3>".JText::_('COM_VIRTUEMART_CART_ORDERDONE_THANK_YOU')."</h3>";

echo 
'<!-- Google Code for Order Conversion Page -->
    <script type="text/javascript">
    /* <![CDATA[ */
    var google_conversion_id = xxxxxxxxxxxx;
    var google_conversion_language = "el";
    var google_conversion_format = "3";
    var google_conversion_color = "ffffff";
    var google_conversion_label = "sqf7COeAtggQkeiqxgM";
    var google_conversion_value = $this->cart->pricesUnformatted["billTotal"];
    var google_remarketing_only = false;
    /* ]]> */
    </script>
    <script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
    </script>
    <noscript>
    <div style="display:inline;">
    <img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/xxxxxxxxxxxx/?value=$this->cart->pricesUnformatted["billTotal"]&amp;label=sqf7COeAtggQkeiqxgM&amp;guid=ON&amp;script=0"/>
    </div>
    </noscript>'
;

echo 
$this->html;
?>

</div>;


Would that work? Is that maybe the better way to go?
Title: Re: Google Adwords Conversion Tracking
Post by: GJC Web Design on August 12, 2014, 23:57:20 PM
can't see it would make the slightest difference
Title: Re: Google Adwords Conversion Tracking
Post by: Danke on September 26, 2014, 13:10:10 PM
Hi all

Thank you for all your posts. Unfortunatelly it's not working for me. I use virtuemart 2.6.6

I've puttet the code like you descripted in:
/components/com_virtuemart/views/cart/tmpl/order_done.php

If i watch at the source of the confirmation page i can't see the tracking code. So it looks like I'm on the false file. But I can't find any other order_done.php.

Quote from logobis:
QuoteI'm user of Google ADWORDS and I confirm that the code should be implement in order_done.php (templates/YOUR_TEMPLATE/html/com_virtuemart/cart/order_done.php). IN my case, it's works perfectly even with 4 kinds of payments-> Paypal, Credit Card (ATOS), Check and Bank Transfer.
I use in virtuemart configuration -> templates -> shopfront settings -> "use joomla default"
But in the default template, i don't have a com_virtuemart folder, it's not existing. Neighter in one of the other templates.

Can anyone help me?

Thank you
Title: Re: Google Adwords Conversion Tracking
Post by: Rune Rasmussen on November 03, 2014, 21:26:46 PM
I've looked into this on VM 2.6.x and it's not working with t.ex "standard" payment module, as it's emptying the cart BEFORE the confirm page is shown.

Line 146 in /plugins/vmpayment/standard/standard.php: $cart->emptyCart ();

Thus $this->cart->pricesUnformatted['billTotal'] will display nothing, as it's empty.

We could comment line 146, but that's probably not a very good idea. Anyone having a better?
Maybe devs could consider to empty the cart later in the process, at the end of the confirmation page, instead of in each payment module?
Title: Re: Google Adwords Conversion Tracking
Post by: alatak on November 04, 2014, 01:57:39 AM
Hello

For the virtue mart piwik plugin, i wrote a system plugin with this event plgVmConfirmedOrder . It should work for Google Adwords also.
Title: Re: Google Adwords Conversion Tracking
Post by: Rune Rasmussen on November 04, 2014, 07:37:00 AM
That's fine, but most people will not be able to do that. And a cart without Google Analytics and Adwords Conversion Tracking is not a "complete" cart.

Btw! From my point of view it seems weird to relay on the payment plugins to empty the cart, that's not very common for a cart system as far as I have seen.

It would be easy to move it I guess. And then add support for adding tracking codes in config, which is inserted to  components/com_virtuemart/views/cart/tmpl/order_done.php and components/com_virtuemart/views/pluginresponse/tmpl/default.php
Title: [SOLVED] Google Adwords Conversion Tracking
Post by: Robert_ITMan on July 21, 2015, 18:16:58 PM
I have the following code that works for my VM 2.6 sites in template cart/order_done.php where the above suggested value from the cart doesn't work (because the cart is already cleared?) so I simply get the info directly from the database for the user as follows:


// begin Google AdWords Conversion added as per https://support.google.com/adwords/answer/6095947
// enter your values
$conversion_id = "1234567890"; // enter your conversion_id
$conversion_label = "abcDefghiJKLmnopqRS"; // enter your conversion_label
$currency = 'CAD'; // enter your currency - or get that from database too
// get this user
$user = JFactory::getUser();
$user_id=$user->id;
// get this order_id,order_total,order_status 
JFactory::getDBO()->setQuery("SELECT virtuemart_order_id,order_total,order_status FROM jos_virtuemart_orders WHERE virtuemart_user_id=$user_id ORDER BY virtuemart_order_id DESC LIMIT 1");
$this_order =JFactory::getDBO()->loadObjectList();
$this_order_id = $this_order[0]->virtuemart_order_id;
$this_order_total = number_format($this_order[0]->order_total, 2, '.', '');
$this_order_status = $this_order[0]->order_status;
//echo '<br />order id '.$this_order_id.' total $'.$this_order_total.' status '.$this_order_status;
if ($this_order_status == 'P' ) {
echo '<h2 style="color:#990000">!!! Sorry your payment did not process, if this is the first time this has happened to you please create a new order and make sure your payment information is correct before confirming it - if it fails again then please visit us or call us during office hours and we will be happy to help.</h2>';
}
echo '
<!-- Google Code for Order Done Conversion Page started 2015-07-21 -->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = '.$conversion_id.';
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "'.$conversion_label.'";
var google_conversion_value = '.$this_order_total.';
var google_conversion_currency = "'.$currency.'";
var google_remarketing_only = false;
/* ]]> */
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/'.$conversion_id.'/?value='.$this_order_total.'&amp;conversion_currency='.$currency.'&amp;label='.$conversion_label.'&amp;guid=ON&amp;script=0"/>
</div>
</noscript>
<!-- end of Google Code for Order Done Conversion Page started 2015-07-21 -->
';
// end Google AdWords Conversion




Title: Re: Google Adwords Conversion Tracking
Post by: Rune Rasmussen on August 10, 2018, 09:14:49 AM
Note! Google Adwords has been rebranded into Google Ads recently (July 2018).

I'll recommend the new 'BIT Google Ads for Virtuemart' plugin released by BARG IT: https://barg-it.de/en/online-shop/extensions-joomla-3/bit-google-ads-for-virtuemart.html

It works great, also with special checkout and payment modules like One Page Checkout and Klarna Checkout, like the rest of their also recommended tracking extensions (FB Pixels, G Analytics etc.): https://barg-it.de/en/online-shop/extensions-joomla-3/bit-virtuemart-tracking-paket.html