VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: alinajenon on October 19, 2015, 19:57:34 PM

Title: Conversion Tracking/Checkout (Google and Facebook)
Post by: alinajenon on October 19, 2015, 19:57:34 PM
VM: 2.6.10 / Joomla: 2.5.27

I have been trying to figure out how to add Google and Facebook tracking code to the checkout thank you page with little success. Google says to place it between the <body> tags of the page you want to track. I apologize as I'm not much of a coder, so the answer might be obvious and I'm just overlooking it.

I know how to find the order_done.php file (and have tried placing code there), but I believe I need more of an html file? since google suggests putting it between the <body> tags. And this is where I have a big gap in basic coding. I'm not sure where to find a file that has the html for the checkout/order_done page.

Any suggestions? Thank you!

Below is the google code:

<!-- Google Code for Purchase Conversion Page -->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 980318407;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "4aiCCP3t02AQx_G50wM";
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/980318407/?label=4aiCCP3t02AQx_G50wM&amp;guid=ON&amp;script=0"/>
</div>
</noscript>
Title: Re: Conversion Tracking/Checkout (Google and Facebook)
Post by: alinajenon on October 19, 2015, 20:14:17 PM
In case the affects anything...

Our credit card checkout is through PayPal Payment Pro, and we also have activated normal PayPal checkout. Thx.
Title: Re: Conversion Tracking/Checkout (Google and Facebook)
Post by: alinajenon on October 19, 2015, 20:21:13 PM
Would I maybe add it to the index.html file here, same file where order_done.php resides? *see attached image

(components>com_virtuemart>views>cart>tmpl>index.html)
Title: Re: Conversion Tracking/Checkout (Google and Facebook)
Post by: GJC Web Design on October 19, 2015, 20:38:04 PM
it doesn't matter at all WHERE on the page it is and order_done is the correct page..  just suck and see...  what's the worst that can happen?..  :)
Title: Re: Conversion Tracking/Checkout (Google and Facebook)
Post by: alinajenon on October 19, 2015, 20:58:37 PM
Ok, I'll try on the index.html file ... I did try on the order_done.php file with no luck. I'll let you know how it goes!
Title: Re: Conversion Tracking/Checkout (Google and Facebook)
Post by: GJC Web Design on October 19, 2015, 21:52:41 PM
no! index.html is just a placeholder file

as I said -- in the order_done.php
Title: Re: Conversion Tracking/Checkout (Google and Facebook)
Post by: alinajenon on October 19, 2015, 23:11:54 PM
Oh, ok. I had already tried the order_done.php without any success (for both facebook and google tracking code).  Go to know I can eliminate the index.html option.
Title: Re: Conversion Tracking/Checkout (Google and Facebook)
Post by: alinajenon on October 20, 2015, 00:20:40 AM
So this (see attachment) is how I have the code pasted into the order_done.php file without any success of being tracked. Any suggestions?
Title: Re: Conversion Tracking/Checkout (Google and Facebook)
Post by: GJC Web Design on October 20, 2015, 09:30:51 AM
1st prove this is the page you arrive at when your order is confirmed

2nd. your pasting html into a php file!!!!!!!

you need to echo it out
Title: Re: Conversion Tracking/Checkout (Google and Facebook)
Post by: alinajenon on October 20, 2015, 16:47:50 PM
Hi, this is why I mentioned I'm a novice at this and have a knowledge gap. I knew it didn't seem right. Do you have any suggestions on where I can look to learn how to "echo it out". And I am 99% sure it is the correct page... based on much digging through all my files, checking the language of the page to file, and what I've read on other forums/sites.

Thanks for your leads so far. It's the furthest I've gotten. I'll look up echoing php into html and see if I have any success.
Title: Re: Conversion Tracking/Checkout (Google and Facebook)
Post by: alinajenon on October 20, 2015, 17:38:18 PM
Ok, take a peak at this screenshot. Am I getting closer?
Title: Re: Conversion Tracking/Checkout (Google and Facebook)
Post by: alinajenon on October 20, 2015, 18:39:22 PM
Well, the above code "broke" the page (just got a blank white page when testing checkout). At least I know I have the correct page! But now I need to figure out the correct code placement.
Title: Re: Conversion Tracking/Checkout (Google and Facebook)
Post by: GJC Web Design on October 20, 2015, 19:37:57 PM
of course..  you have a mixture of double and single quotes .. you can see the problems immediately from your screen code highlighting

escape the single quotes  \'
Title: Re: Conversion Tracking/Checkout (Google and Facebook)
Post by: alinajenon on October 20, 2015, 20:15:12 PM
Yes. I'm sorry, I KNOW these are very unknowledgeable and basic questions... but if you have a moment, can you point out what is highlighted in the code? and what you mean by "escape the single quotes /' "? I prob don't have enough basic programming knowledge for this forum... I'm just not sure where else to turn. Thank you for all you've offered so far.
Title: Re: Conversion Tracking/Checkout (Google and Facebook)
Post by: GJC Web Design on October 20, 2015, 21:41:08 PM
This is really basic php ...  if you have echo 'blah';

then u can't have ' in the string

escape them

echo 'blah can\'t have a \' in the string';
Title: Re: Conversion Tracking/Checkout (Google and Facebook)
Post by: alinajenon on October 29, 2015, 16:57:35 PM
My programmer was finally able to look into it, and did a simple fix of ending the php with "?>" (not the quotes, just the ?>)so that the html could be placed and it seems to be tracking fine now.

Thanks for all of your help, GJC, and patience with my limited knowledge. Just posting the above in case another novice comes along and may need some php 101 help.