Forums

JavaScript Tracking Code

JoeKMT 07 Oct, 2009
Could you please look at this tracking code and hi-light which part of the code goes into the "Form JavaScript", it also looks like I may need to add some of this into the "Form HTML" I'm just not sure.

Thank you very much!

Joe

<SCRIPT LANGUAGE = 'JavaScript'>
<!--
svaid = 204720;
bts_amount = 1;
origin = escape(document.referrer);
-->
</SCRIPT>
<SCRIPT LANGUAGE = 'JavaScript'
SRC="https://www2.higherengine.com/bts/204720/bts.js">
</SCRIPT>

<NOSCRIPT>
<img src="https://www2.higherengine.com/bts/204720/bts.php?svaid=204720&amt=1" alt="">
</NOSCRIPT>
GreyHead 07 Oct, 2009
Hi JoeKMT,

Here's how I would do it in the Form HTML; using the $doc syntax will load it into the page header rather than the body.
<?php
$script = "
  svaid = 204720;
  bts_amount = 1;
  origin = escape(document.referrer);
";
$doc =& JFactory::getDocument();
$doc->addScriptDeclaration($script);
$doc->addScript("https://www2.higherengine.com/bts/204720/bts.js");
?>
<noscript>
<img src="https://www2.higherengine.com/bts/204720/bts.php?svaid=204720&amt=1" alt="">
</noscript>

Bob
JoeKMT 07 Oct, 2009
Thanks Bob, I gave that a try and I'm waiting to hear back from the SEO Company to see if it worked, I'll let you know and mark the post as solved. I really love your product and your support.

Joe
GreyHead 07 Oct, 2009
Hi Joe,

Thank you, fingers crossed that it works!!

Bob
JoeKMT 07 Oct, 2009
Hi Bob,
Well that did not work for them because they want me to add the code to the Thank You page that shows up after the form is submitted, since the Thank You page is dynamically created do you have any idea how I can add that code to the Thank You page?
The Thank You page is an uncategorized artical page.

Thanks,

Joe
GreyHead 07 Oct, 2009
Hi Joe,

How are you dynamically creating the article?

Bob
JoeKMT 07 Oct, 2009
I have created an uncategorized article which I then redirect the user to after the form is submitted.

Joe
GreyHead 08 Oct, 2009
Hi JoeKHT,

Ah - so it's not 'dynamic' in the sense that it's customised for this user.

Then scrap that article, remove the redirect url, and instead put the html into the ChronoForm OnSubmit After box along with the tracking code.

Bob
JoeKMT 08 Oct, 2009
Hi Bob,
So I copy the HTML that is generated for the Thank You page and paste it into, I'm just trying to make sure I put it in the right spot, Form Code - On Submit code - after sending email: (PHP code with tags). Do I need to surround the HTML with An opening and closing PHP tag or some sort of other PHP coding? Sorry I'm not real up on PHP.

Thanks for all of your help!!!!!!

Joe
JoeKMT 08 Oct, 2009
Hey Bob ,
Ok, last night I tried just adding the code in the body of the Thank You page, guess what, it worked, they were able to see it and it recorded the hit in their software, so go figure. Can't tell you how much a really appreciate all of your help, wish I could have figured this out using one of your methods.

Thanks again,

Joe
GreyHead 08 Oct, 2009
Hi Joe,

Putting the code in the Thank You article will work fine. A problem migth arise if the code was variable - that is you were trying to track several differetn product with the same page; then the ChronoForms OnSubmit would work better.

Bob

PS No need for <?php tags around HTML - they wil just break it. They are to tell the server that what follows *isn't* HTML but shoudl be interpreted as PHP.
This topic is locked and no more replies can be posted.