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

Adwords Tracking in Virtuemart 2

Started by Darren_R, August 29, 2012, 05:25:40 AM

Previous topic - Next topic

Darren_R

Hi There,

I am hoping someone can help.

I am trying to effectively setup Google ADWORDS conversion tracking in the Virtuemart 2 system.  We have 2 payment methods (Paypal and Bank Direct Deposit).

So far I have been able to update the "Order_Done.php" file (in directory components\com_virtuemart\views\cart\tmpl) to include the Javascript tracking code for orders completed via the direct debit payment method.

What I can not do is find out where or how to update the same for the Paypal payment method.

Any help is much appreciated

Darren

ivus

/plugins/vmpayment/paypal/paypal.php

function _getPaymentResponseHtml ($paypalTable, $payment_name) {

   STICK YOUR CODE INSIDE THIS FUNCTION...

}

enspyre

Dear Darren_R (or someone else), Could you perhaps show me exact how to insert the conversion javascript into the "order_done.php" file? However I copy it in there I get an error. Maybe you could just show the code?

Thanks!

Elias

Quote from: Darren_R on August 29, 2012, 05:25:40 AM
Hi There,

I am hoping someone can help.

I am trying to effectively setup Google ADWORDS conversion tracking in the Virtuemart 2 system.  We have 2 payment methods (Paypal and Bank Direct Deposit).

So far I have been able to update the "Order_Done.php" file (in directory components\com_virtuemart\views\cart\tmpl) to include the Javascript tracking code for orders completed via the direct debit payment method.

What I can not do is find out where or how to update the same for the Paypal payment method.

Any help is much appreciated

Darren

enspyre

Sorry, same would go for Paypal. Where/how to insert it exactly in the code?

PRO

INSIDE HERE
*/
   function _getPaymentResponseHtml ($paypalTable, $payment_name) {

      $html = '<table>' . "\n";
      $html .= $this->getHtmlRow ('PAYPAL_PAYMENT_NAME', $payment_name);
      if (!empty($paypalTable)) {
         $html .= $this->getHtmlRow ('PAYPAL_ORDER_NUMBER', $paypalTable->order_number);
         //$html .= $this->getHtmlRow('PAYPAL_AMOUNT', $paypalTable->payment_order_total. " " . $paypalTable->payment_currency);
      }
      $html .= '</table>' . "\n";

      return $html;
   }


BUT, what is your code?

enspyre

I have to insert Google Adwords and Facebook ad conversion scripts into the right page to track purchases made on Virtuemart. We have two payment methods, Paypal and a ATM (the customer just gets a page with bank info so they can go and transfer money to us).

I have found some plugins that will do this for Google Analytics conversion but not Adwords and Facebook.

I am not savvy enough to figure our exactly where/how on "order_done.php" or "paypal.php" on insert this (if that is indeed what should be done) without causing errors.

I would very much appreciate some clear directions.

The code is basically this:

<!-- Google Code for Purchase Conversion Page -->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 55555555555555555;
var google_conversion_language = "en";
var google_conversion_format = "2";
var google_conversion_color = "ffffff";
var google_conversion_label = "5555555555555";
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/5555555555555555555/?value=0&amp;label=555555555555555555555&amp;guid=ON&amp;script=0"/>
</div>
</noscript>


<script type="text/javascript">
(function() {var p = function(x) {var q=[],s=(x!=null)?x.toString():'';if(window.RegExp)
s.replace(new RegExp("(sb_[^?=&]+|__sb_[^?=&]+)(=([^&]*))?", "g"),function($0,$1,$2,$3){ q.push($1+'='+$3); });
else q=['sb_err=NoRegExp'];var i=s.indexOf('?');s=(i>0)?s.substr(0,i+1)+q.join('&'):s;return(escape(s));};
var l=[p(window.location),p(document.referrer)];var u=(document.location.protocol)+"//track.brighteroption.com/b?p=sx2rkp&l=0"+
"&src="+l[0]+"&sref="+l[1]+"&rnd="+(Math.random()*(1 << 30)).toString(16).replace('.', '');
var px=document.createElement('iframe');px.src=u;px.width=0;px.height=0;px.setAttribute('frameborder',0);
px.setAttribute('marginheight',0);px.setAttribute('marginwidth',0);px.setAttribute('scrolling','no');document.body.appendChild(px);})();
</script>

PRO

I do not have time to do this right now, but there are a few ways to do it. respond to this thread so I dont forget it

cristirp

I added the script right after the line,
function _getPaymentResponseHtml ($paypalTable, $payment_name) {

located in:
/plugins/vmpayment/paypal/paypal.php


But then when I access my website, I get the error
Parse error: syntax error, unexpected '<' in /home/content/22/2592922/html/riovidastore.com/plugins/vmpayment/paypal/paypal.php on line 878,

which is the line:
<script type="text/javascript">

in the Google code:

<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 959237110;
var google_conversion_language = "en";
var google_conversion_format = "1";
var google_conversion_color = "ffffff";
var google_conversion_label = "ZQIDCMKRwwUQ9pezyQM";
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/959237110/?value=0&amp;label=ZQIDCMKRwwUQ9pezyQM&amp;guid=ON&amp;script=0"/>
</div>
</noscript>


Help?

Thanks!

PRO

Quote from: cristirp on March 26, 2013, 02:42:27 AM
I added the script right after the line,
function _getPaymentResponseHtml ($paypalTable, $payment_name) {

located in:
/plugins/vmpayment/paypal/paypal.php


But then when I access my website, I get the error
Parse error: syntax error, unexpected '<' in /home/content/22/2592922/html/riovidastore.com/plugins/vmpayment/paypal/paypal.php on line 878,

which is the line:
<script type="text/javascript">

in the Google code:

<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 959237110;
var google_conversion_language = "en";
var google_conversion_format = "1";
var google_conversion_color = "ffffff";
var google_conversion_label = "ZQIDCMKRwwUQ9pezyQM";
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/959237110/?value=0&amp;label=ZQIDCMKRwwUQ9pezyQM&amp;guid=ON&amp;script=0"/>
</div>
</noscript>


Help?

Thanks!


because you cannot just put html in there like that.

I dont have my development server on right now, to look at how to do this.


you might can do this right in your Joomla template like this

YOU HAVE TO CHANGE THE VIEW FROM productdetails
To whatever the view is.


<?php if (JRequest::getVar('view')=='productdetails') { ?>
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 959237110;
var google_conversion_language = "en";
var google_conversion_format = "1";
var google_conversion_color = "ffffff";
var google_conversion_label = "ZQIDCMKRwwUQ9pezyQM";
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/959237110/?value=0&amp;label=ZQIDCMKRwwUQ9pezyQM&amp;guid=ON&amp;script=0"/>
</div>
</noscript>
<?php } ?>




cristirp

Thanks for the response.

However, if I do that, I get an error on line:
<?php if (JRequest::getVar('view')=='productdetails') { ?>

I put this right after the line:
function _getPaymentResponseHtml ($paypalTable, $payment_name) {


Also, how do I know what it should be, rather than "productdetails"? Thanks!!

PRO

Quote from: PRO on March 30, 2013, 18:31:26 PM
Quote from: cristirp on March 26, 2013, 02:42:27 AM
I added the script right after the line,
function _getPaymentResponseHtml ($paypalTable, $payment_name) {

located in:
/plugins/vmpayment/paypal/paypal.php


But then when I access my website, I get the error
Parse error: syntax error, unexpected '<' in /home/content/22/2592922/html/riovidastore.com/plugins/vmpayment/paypal/paypal.php on line 878,

which is the line:
<script type="text/javascript">

in the Google code:

<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 959237110;
var google_conversion_language = "en";
var google_conversion_format = "1";
var google_conversion_color = "ffffff";
var google_conversion_label = "ZQIDCMKRwwUQ9pezyQM";
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/959237110/?value=0&amp;label=ZQIDCMKRwwUQ9pezyQM&amp;guid=ON&amp;script=0"/>
</div>
</noscript>


Help?

Thanks!


because you cannot just put html in there like that.

I dont have my development server on right now, to look at how to do this.


you might can do this right in your Joomla template like this

YOU HAVE TO CHANGE THE VIEW FROM productdetails
To whatever the view is.


<?php if (JRequest::getVar('view')=='productdetails') { ?>
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 959237110;
var google_conversion_language = "en";
var google_conversion_format = "1";
var google_conversion_color = "ffffff";
var google_conversion_label = "ZQIDCMKRwwUQ9pezyQM";
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/959237110/?value=0&amp;label=ZQIDCMKRwwUQ9pezyQM&amp;guid=ON&amp;script=0"/>
</div>
</noscript>
<?php } ?>






"you might can do this right in your Joomla template like this"

^^^^