Forums

include adwords code

arana 04 Mar, 2009
Hi i am trying to include some adwords code to the form, i see i must remove the tags first, but the tags have the SRC url for the script, how do i add this to my form? :
<script language="JavaScript" type="text/javascript">
<!--
var google_conversion_id = 111111111;
var google_conversion_language = "en_US";
var google_conversion_format = "1";
var google_conversion_color = "ffffff";
var google_conversion_label = "222222222222";
//-->
</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/1111111111111/?label=222222222222222222&guid=ON&script=0"/>
</noscript>
???
GreyHead 04 Mar, 2009
Hi arana,

Try this in your Form HTML:
<?php
$doc =& JFactory::getDocument();
$script ="var google_conversion_id = 111111111;
var google_conversion_language = 'en_US';
var google_conversion_format = '1';
var google_conversion_color = 'ffffff';
var google_conversion_label = '222222222222';
";
$doc->addScriptDeclaration($script);
$doc->addScript("http://www.googleadservices.com/pagead/conversion.js");
?>
<noscript>
<img height="1" width="1" border="0" src="http://www.googleadservices.com/pagead/conversion/1111111111111/?label=222222222222222222&guid=ON&script=0"/>
</noscript>

Bob
arana 04 Mar, 2009
no wonder i was trying to put that in JS section and does not even close to what i had lol

looks like it is correct now looking at source code, now i have to wait for the adwords guy to see if its actually doing what it is supposed to do (i know ZERO about adwords)


thank you GH

rapid and to the point as usual!
GreyHead 04 Mar, 2009
Hi arana,

You could put the script snippet in the JavaScrip box (but not the link to the external file). I have recently come to prefer the Joomla 1.5 $doc-> functions because they put the scripts neatly into the page header which makes finding and de-bugging them much easier.

Bob

PS It's got very busy here recently, barely any time for chitchat between reading the mails and deleting the spam :-)
arana 06 Mar, 2009
Hi GH, the adwords people told me i only need to include that code once user submits the form so i changed it to the submit sectioon of the form but the result is the same, the code loads even when user has not submitted, how can i deal with that?
i was thinking on setting up a content-article with legend such as "thank you for your submission" , but then maybe some user can go to it directly and the script will count it as valid.

i would appreciate any help.

Thanks
GreyHead 06 Mar, 2009
Hi arana,

If the code is *only* in the OnSubmit After box then it won't display when the form is loaded - only after it submits.

Post a link to the form page if it helps.

Bob
arana 06 Mar, 2009
yes the code is only in the subit after box, but it shows in the form code nonetheless even without submission

i will send the site url as a PM since they are actually using the form right now
GreyHead 06 Mar, 2009
Hi arana,

No PM so far.

If it's showing in the form then I think that the code *must* still be in the FormHTML. None of the OnSubmit code is processed at all when the form is displayed.

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