Forums

Google conversion tracking

grantbosh 17 Oct, 2008
Hi,

I would like to add google conversion tracking to that message that gets displayed when a form is successfully submitted. Can anyone explain how I would go about doing this?

Regards
Grant
GreyHead 17 Oct, 2008
Hi Grantbosh,

Looks as though you need to put the Google code in the OnSubmit after box (along with a little Thank you message) so that it is shown on coversion. Here's the Google sample code
<!-- Google Code for Purchase Conversion Page --> 
<script language="JavaScript" type="text/javascript"> 
<!-- 
var google_conversion_id = 1234567890; 
var google_conversion_language = "en_US"; 
var google_conversion_format = "1"; 
var google_conversion_color = "666666"; 
if (<? echo $totalValue ?>) {
   var google_conversion_value = <? echo $totalValue ?> 
} 
var google_conversion_label = "Purchase"; //--> 
</script> 
<script language="JavaScript" src="http://www.googleadservices.com/pagead/conversion.js"> </script>
<noscript> 
<img height=1 width=1 border=0 src="http://www.googleadservices.com/pagead/conversion/1234567890/?value=<? echo $totalValue ?>&label=Purchase&script=0">
</noscript> 


Bob
grantbosh 18 Oct, 2008
Hi Bob,

Thanks for the reply, I have the tracking code from Google, but I need a little more of a detailed explanation as to where to copy it in... where do I find this on submit after box?

Regards
Grant
Max_admin 18 Oct, 2008
Hi Grant,

Put the code at the onsubmit box, how do you display a thank you message after submission ?

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 18 Oct, 2008
Hi Grant,

The OnSubmit boxes are on the Form Code tab. There are two boxes that will open from the blue +- signs. Both will execute when the form is submitted, the 'OnSubmit before' code *only* executes if "Email the results" is set to YES, 'OnSubmit after' code always executes.

Bob
ccondo 21 Oct, 2009
I have added the google tracking code to the onSubmit section and I have configured the google code to display the google site stats image. When I submit the form I know this section of the code is working because I see it on the website source, I do not see the google image so it appears the google tracking code does not work.
GreyHead 21 Oct, 2009
Hi ccondo,

What code do you have in the OnSubmit box? Probably the image link is broken somehow??

Bob
ccondo 22 Oct, 2009
<!-- Google Code for Website Assessment Conversion Page -->
<script type="text/javascript">
<!--
var google_conversion_id = 107134046;
var google_conversion_language = "en_US";
var google_conversion_format = "1";
var google_conversion_color = "ffffff";
var google_conversion_label = "v9XiCO_BqAEQs7ft_gM";
var google_conversion_value = 0;
if (20.0) {
google_conversion_value = 20.0;
}
//-->
</script>
<script type="text/javascript" src="http://www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="http://www.googleadservices.com/pagead/conversion/107134046/?value=20.0&label=v9XiCO_BqAEQs7ft_gM&guid=ON&script=0"/>
</div>
</noscript>
ccondo 08 Jan, 2010
I discovered why this was not working - I wasn't coming to the form as a result of clicking on a google ad.
eglescout 15 Sep, 2010
I've read this, and I think I've set everything correctly. I still am not getting any conversions coming through. Here's my code:

<?php JFactory::getApplication()->enqueueMessage( JText::_( 'Success! Thank you for requesting the sample questions. You should receive an email confirmation shortly.' ), 'message' );
?>
<!-- Google Code for Free Questions Conversion Page -->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 1071733997;
var google_conversion_language = "en";
var google_conversion_format = "1";
var google_conversion_color = "eeeeee";
var google_conversion_label = "GhZ4CNiflwEQ7bmF_wM";
var google_conversion_value = 0;
/* ]]> */
</script>
<script type="text/javascript" src="http://www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="http://www.googleadservices.com/pagead/conversion/1071733997/?label=GhZ4CNiflwEQ7bmF_wM&guid=ON&script=0"/>
</div>
</noscript>

I also have the redirect url set to the the unsecure version of the home page (http:). The previous version of this form (not Chronoforms 😢 ) used to bring in ~120 conversions per month. Now I haven't seen any.

Any ideas? Thanks!
GreyHead 16 Sep, 2010
Hi eglescout,

Where exactly have you got this code?

When you view the page source can you see the JavaScript?

Bob

PS This is explained in more detail in Chapter 7 of The ChronoForms Book
Mc Robert 25 Feb, 2013

Hi Grantbosh,

Looks as though you need to put the Google code in the OnSubmit after box (along with a little Thank you message) so that it is shown on coversion. Here's the Google sample code

<!-- Google Code for Purchase Conversion Page --> 
<script language="JavaScript" type="text/javascript"> 
<!-- 
var google_conversion_id = 1234567890; 
var google_conversion_language = "en_US"; 
var google_conversion_format = "1"; 
var google_conversion_color = "666666"; 
if (<? echo $totalValue ?>) {
   var google_conversion_value = <? echo $totalValue ?> 
} 
var google_conversion_label = "Purchase"; //--> 
</script> 
<script language="JavaScript" src="http://www.googleadservices.com/pagead/conversion.js"> </script>
<noscript> 
<img height=1 width=1 border=0 src="http://www.googleadservices.com/pagead/conversion/1234567890/?value=<? echo $totalValue ?>&label=Purchase&script=0">
</noscript> 


Bob



Above is the best example of Google conversion tracking. Thanks Bob !!
01 27 Jun, 2013
Hello!
Now I've a task to enable the google conversion after a welcome screen appears.
I've found this suggestion in FAQ:
http://www.chronoengine.com/faqs/3451-how-can-i-add-google-conversion-tracking.html
From first view it has mistake with double quotes "", the are not properly handled. The "\" should be palced inside $script.
But after this quick patch the script doesn't work.
I'm providing the otuput from google tag assistant:
TAGS FOUND
Status
AdWords Conversion Trackingnot working
Conversion ID
xxx
Conversion Label
xxxx
Conversion Value
1
<script> tag found  
Conversion Value in the <noscript> tag
{$track_value}
Error: No HTTP response detected help
Error: Dynamic conversion value in wrong format in the <noscript> tag. help
Error: Conversion value mismatch between <script> and <noscript> tag. help
Warning: Missing CDATA comments. h

The last error isn't major, but the CDATA miss is not the good thing...

The PHP code:

<?php
$track_value = 1;
/* Google Code for Purchase Conversion Page */
$doc =& JFactory::getDocument('http://www.googleadservices.com/pagead/conversion.js');
$doc->addScript();
$script = "
var google_conversion_id = xxx;
var google_conversion_language = 'en';
var google_conversion_format = '2';
var google_conversion_color = 'ffffff';
if ( {$track_value} ) {
   var google_conversion_value = {$track_value};
}
var google_conversion_label = 'xxx';
";
$doc->addScriptDeclaration($script);
echo '<noscript>
<img height=1 width=1 style="border-style:none;" alt="" src=\'http://www.googleadservices.com/pagead/conversion/xxx/?value={$track_value}&label=xxx-1QM&guid=ON&script=0\' />
</noscript>';
?>

Waiting for some help😀
P.S. if it makes sense - I'm using the 4.0 RC3.5.1 version
GreyHead 27 Jun, 2013
Hi 01,

You are right about the quotes in the first part of the code - my fault for not editing it correctly. I have updated the FAQ code.

I think that the other errors come because you also changed the quotes in the 'noscript' part which were correct.

Bob
01 27 Jun, 2013
Hi, GreyHead!
Thank you for you promt reply!
I've updated my code with yours.
But I still receive two error:

Error: No HTTP response detected help
Warning: Missing CDATA comments

The
Error: No HTTP response detected help
also is repeated in Google Analytics domain...
Maybe I've additional errors... But overchecked everything and it seems that I shouldn't have any additional🙂
GreyHead 27 Jun, 2013
Hi 10,

Sorry I'm not a Google Conversion tracking user and I have no idea what that error means or how to fix it :-( Debugging the script in action might help?

Bob
01 27 Jun, 2013
HI, GreyHead!
I will try to debug... But actually I don't know where to look🙂
Maybe users who already have implemented this feature could post a reply with their results🙂
01 27 Jun, 2013
As I had also a problem with google analytics when thanks message appeared I've revised the GA and google webmaster tools validation codes placement. It was placed by hand by all rules in the head section. Then I installed a special plugin from joompla extension catalog which places the GA and google web master tools codes automatically. After that the problem with GA disappeared. So, I think the problem is in code placement. Probably the special option or component should be additionally developed which will work only with google conversion tracking...
01 27 Jun, 2013
Just enabled on local machine the error reporting and here what I found:

Warning: Missing argument 1 for JDocument::addScript(), called in x:\htdocs\joomla\administrator\components\com_chronoforms\form_actions\custom_code\custom_code.php(19) : eval()'d code on line 4 and defined in x\htdocs\joomla\libraries\joomla\document\document.php on line 461
GreyHead 27 Jun, 2013
Hi 01,

Sorry, another bug in the FAQ gave that message. These two lines should look like this.
$doc =& JFactory::getDocument();
$doc->addScript('http://www.googleadservices.com/pagead/conversion.js');


I've corrected the FAQ.

Bob
01 28 Jun, 2013
Hi, GreyHead!
Yes, it was error and I haven't noticed it. Just copied and pasted🙂
After this fix the more errors came out🙂

TAGS FOUND
Status
AdWords Conversion Trackingnot working
Conversion ID
xxx
Conversion Label
xxx
Conversion Value
1
<script> tag found  
Conversion Value in the <noscript> tag {$track_value}
Error: No HTTP response detected help
Error: Code found outside of <body> tag. help
Error: Dynamic conversion value in wrong format in the <noscript> tag. help
Error: Conversion value mismatch between <script> and <noscript> tag. help
Warning: Missing CDATA comments. help
Google Analyticsworking
GreyHead 27 Jul, 2013
Hi 01,

Just looking at this again and the quotes are wrong in the noscript part you have to have double quotes round a string that is used with echo if you want to include PHP variables:
echo "<noscript>
<img height='1' width='1' style='border-style:none;' alt='' src='http://www.googleadservices.com/pagead/conversion/xxx/?value={$track_value}&label=xxx-1QM&guid=ON&script=0' />
</noscript>";

Bob
01 27 Jul, 2013
Hi, GreyHead!
Eh, still doesn't solve the problem😟


AdWords Conversion Tracking xxx Critical Issues

Conversion ID
xxx
Conversion Label
Lxxxx-1QM
Conversion Value
1
<script> tag found  
Error: No HTTP response detected more info
Error: Code found outside of <body> tag. more info
Warning: Missing CDATA comments. more info

GreyHead 30 Jul, 2013
Hi 01,

Sorry, I don't see any more obvious errors; at this point you get to do the detailed debugging.

Bob
This topic is locked and no more replies can be posted.