AdWords
3.1K members online now
3.1K members online now
Use AdWords conversion tracking and reporting to measure your results. Have a question about Google Analytics? Post it here, on the Google Analytics Community!
Guide Me
star_border
Reply

Adding Adwords conversion code via javascipt

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Adding Adwords conversion code in javascipt embed popup “Thank you” message on same page.

 

Hi,

I have started using AdWords for my site and my conversion is that when someone filled up lead form.

But I don’t have “Thank you” page where user goes after filling data, however its show “Thank you” message after submitting details, and that message is called by javascript.

Now question is that if I have embed that “Conversion tracking” code with that “thank you message” will it record conversion ?

And is it possible to track which leads is coming from AdWords and from which keyword, and which leads is coming from organic/direct.

 

2 Expert replyverified_user

Re: Adding Adwords conversion code via javascipt

Top Contributor
# 2
Top Contributor

Hi @Lewis A as long as the conversion tracking code fires properly when the message is displayed, it should record correctly.  And yes, it'll record in AdWords which Keyword caused the conversion, though it won't show you organic traffic - you'll need to look at Analytics for that.

 

You might want to consider using Google Tag Manager on your site instead of simple Analytics.  GTM will allow you to create events for form submissions - which seems ideal for this situation - which can then be tracked in Analytics.  If you do this, you could import the Analytics goal to AdWords to track results there and track the goals from organic and other traffic sources.

 

Jon

AdWords Top Contributor Google+ Profile | Partner Profile | AdWords Audits

Re: Adding Adwords conversion code via javascipt

Collaborator ✭ ☆ ☆
# 3
Collaborator ✭ ☆ ☆
I concur with Jon, GTM is the way to go here. I've tried putting the conversion code directly in an AJAX form script to load when the thank you message appears, and for whatever reason it did not work consistently. GTM has a function called a Form Submit Listener. It's pretty easy to setup so that when it detects a form submission it fires the conversion code. It works 100% of the time. GTM also has a test mode so you can confirm it's working correctly before a real conversion comes in.

Re: Adding Adwords conversion code via javascipt

Top Contributor
# 4
Top Contributor
Hi Lewis and David.

The reason the conversion code does not work when it is delivered by AJAX is no Javascript included with that content is executed. It's a security thing.

The answer to Lewis' question is, "it depends on how that content is delivered." If it's an AJAX call, the code won't run. If it is returned as the src of an iFrame, that will run. If you just show a hidden division with the thank you message, that won't work.

The problem I see with the GTM tracking, that tracks the form submission but does not confirm the submission was successful.

The best (or easiest) way to track conversion in AJAX content is to include only the image part of the AW conversion script. Do not include the script or noscript tags, just the image. That image could be created in Javascript after the form submission has been confirmed. You would need to include a function on the original page that you can call when the AJAX call has returned a success code.

Just as a side note, nothing works 100% of the time, but certain approaches will get closer than others. None of this works if Javascript has been disabled by the user. And the AW code won't work properly if 3rd party cookies have been blocked.

Best of Luck!

Pete
petebardo -- Deadhead doing AdWords

Re: Adding Adwords conversion code via javascipt

Top Contributor
# 5
Top Contributor

@petebardo GTM does actually have a checkbox for form submission validation, however, the wording is interesting:

 

"Only fire tags if the form will successfully submit."

 

The "will" suggests to me that it's actually only predicting the outcome of the submission, rather than actually seeing a confirmed submit.

 

Jon

AdWords Top Contributor Google+ Profile | Partner Profile | AdWords Audits