News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Need to add google tracking code to....

Started by ScottKR24, July 05, 2012, 14:33:16 PM

Previous topic - Next topic

ScottKR24

I need to add google tracking code in the head tag of either the thank you page or the order confirmation page. I've downloaded the com_virtualmart folder from the server but there's so many files to look thru I'm not even sure where to look or what to look for. Please help, thanks.

ivus

Hi ScottKR24,

you can put it on this page

/components/com_virtuemart/views/cart/tmpl/order_done.php

This page appears once the order has been placed successfully.

I hope this helps.

KarlRanseier

#2
yes the order_done.php is the right place for the tracking code but there is not much information about the bought products.
I have just few info about the shipping method, paymentmethod, and the total prices and taxes.
Would be nice to know how to get product information for this order...

Google tracking code:
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-XXXXX-X']);
  _gaq.push(['_trackPageview']);
  _gaq.push(['_addTrans',
    '1234',           // order ID - required
    'Acme Clothing',  // affiliation or store name
    '11.99',          // total - required
    '1.29',           // tax
    '5',              // shipping
    'San Jose',       // city
    'California',     // state or province
    'USA'             // country
  ]);

   // add item might be called for every item in the shopping cart
   // where your ecommerce engine loops through each item in the cart and
   // prints out _addItem for each
  _gaq.push(['_addItem',
    '1234',           // order ID - required
    'DD44',           // SKU/code - required
    'T-Shirt',        // product name
    'Green Medium',   // category or variation
    '11.99',          // unit price - required
    '1'               // quantity - required
  ]);
  _gaq.push(['_trackTrans']); //submits transaction to the Analytics servers

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>
Joomla 2.5.4 - VM 2.0.8c - custom template

ivus

Hi KarlRanseier,

You should still have the order id when you're on that page. Why not write a query to grab the products from the order. I think the code is already written, you just need to target it.

I hope this helps.  ;D

berghoff

Please tell me how to get the order id inside order_done file.

Thank you.

Florentp

#5
Quote from: berghoff on August 16, 2012, 13:39:47 PM
Please tell me how to get the order id inside order_done file.

Thank you.

Hey Berghoff !
If you can wait 24-48h, I'll tell you how to do.
I have to implement some custom functions in this page tomorrow for my own project.
Once I know more, I explain how.


ivus, thanks for this information
Can we be sure that this page is the good one ?
I mean.. What if customer pay on the bank website and never get back to the store !?
Web programmer. Passionate.
PHP, SQL, Javascript, JQuery, css.
Skype : florent.indienboutique

berghoff

After the payment is processed on the bank-side. Notification can be sent back to your site with POST.

This page is the best if you want to do the same operation for all payment types.

Waiting for your notes FederA.

Florentp

Hum, sorry men, finally i did something else.
Web programmer. Passionate.
PHP, SQL, Javascript, JQuery, css.
Skype : florent.indienboutique

PRO


enspyre

Exactly HOW do I put the Adwords Javascript into "order_done.php"?

I guess I can't just past it in the end since that creates an error. I would very much appreciate a sample page.

Thanks,
Elias

PRO

whats the code first of all?

You probably are just not doing it right.


romatvirtue

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.

romatvirtue

I have actually inserted the code like this:
Quote from: PRO on March 15, 2013, 18:32:26 PM
whats the code first of all?

You probably are just not doing it right.


I have actually inserted the code like this:

echo '<script type="javascript">
var a =  "123";
var b =  "456";
var c =  "789";
</script>
<script language="javascript" src="https://www.facebook.com/xxxxxxxxxtracker.js">';


Even though, their syntax is like this:
echo '<script type="javascript">
var a =  '123';
var b =  '456';
var c =  '789';
</script>
<script language="javascript" src="https://www.facebook.com/xxxxxxxxxtracker.js">';


I might not have written it properly. That's the only way it's not giving me an error. Also, how would I insert another similar tracking code? Your help will be greatly appreciated.

Thanks.

Maxim Pishnyak

So did you try to insert this code or you did not?
You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart

romatvirtue

Quote from: Maxim Pishnyak on September 15, 2013, 13:12:53 PM
So did you try to insert this code or you did not?

I did. However, nothing was tracking. So I thought I did something wrong, that's why I posted a question. Did I properly insert the code? The echo, single quotes and stuff...

Thanks.