Portal Home > Knowledgebase > Articles Database > Will this work?
Will this work?
Posted by SmashedPumpkins, 01-06-2010, 10:37 PM |
As you can see I want to run the Javascript code once the user clicks the link. If not, how should I go about doing this? I can't test this because adwords updates slowly. Thanks
Randy
|
Posted by RemyHorton, 01-06-2010, 10:46 PM |
You'll need to rewrite adwords() as a Javascript function rather than a PHP function. As it is all the content of adwords() appears within onclick= upon page load, which i doubt will work.
|
Posted by foobic, 01-06-2010, 10:48 PM |
No, it won't work. What exactly are you trying to achieve?
|
Posted by SmashedPumpkins, 01-06-2010, 11:02 PM |
Here's the deal. Google Adwords offers a conversion tracking system. To use it I need to add the Javascript code provided by Google into my confirmation page. (The page that tracks the conversion. A conversion is when someone clicks an advertisement and signs up for my product) I would like the conversion to be triggered as soon as the user clicks the continue image link on my page rather then on an actual confirmation page.
So in other words, as soon as the user presses continue it should trigger the Javascript code letting Google know that a conversion has taken place. I do not want to run the Javascript code until the user clicks the continue button.
Thanks a ton! I just can't figure it out in my head.
Randy
|
Posted by foobic, 01-06-2010, 11:28 PM |
I'd seriously suggest you give it up and just generate a confirmation page in PHP (or whatever server-side language you prefer).
In javascript you'd need to modify the DOM to display the extra content - that's easy enough, but I don't think the browser would run the external scripts, so then AJAX to pull those in?? An iframe would work but that's nasty, and another page load anyway. Worst of all, what you're attempting is going to look too much like clickjacking - have you checked Google's ToS?
|
Posted by SmashedPumpkins, 01-06-2010, 11:56 PM |
Dang I setup a page before hand with an HTML redirect, but the lag took too long for me. I really didn't think it'd be so hard. There's no way to make it run the Javascript before leaving the page?
|
Posted by Dr:linux, 01-07-2010, 08:07 AM |
It seems that your Google conversion variables are outside the scope of the function.These Google Ad words Conversion Tracking code can be converted into other which is more useful. For converting the code, take the conversion code provided and convert it into this as follows :
Google AdWords conversion will now be a button click event. Please let me know any further assistance required.
|
Add to Favourites Print this Article
Also Read