5.4K members online now
5.4K 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

Best way to track conversions based on JavaScript events?

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

My signup form posts asynchronously to my servers so I don't have a separate page to put the conversion code on. I need to trigger the conversion from JavaScript. I've seen two ways of doing this:


1. Add the tracking pixel to the page with JavaScript.

2. Set the variables and then load the conversion script using jQuery's getScript. (See


Will both of these work? Are they both equivalent? Is there a better or recommended or canonical way of doing this?





2 Expert replyverified_user

Re: Best way to track conversions based on JavaScript events?

Top Contributor
# 2
Top Contributor
I know this can also be done with an onclick event. Requires the conversion code to be modified to work with an image...see this article, it is old but you'll get the jist

Will that possibly help?

Kim Clink, AdWords Top Contributor | Community Profile | Twitter | Clink Digital Marketing
Did you find any helpful responses or answers to your query? If yes, please mark it as the 'Best Answer.'

Re: Best way to track conversions based on JavaScript events?

Top Contributor
# 3
Top Contributor

Hi Tom,


Like most questions on this forum, the answer is "that depends". If all conversions have the same value, you could use Analytics event tracking to set up a goal. Basically, you record a pageview in the script for a page (that either exists or not). In the onsubmit event of the form you would add the trackpageview code. That depends on which version of the tracking code you are using. You would then import that goal to AdWords as a conversion.


If you are recording the value of each transaction, I go with the image part of the tracking code, returned  with the Ajax response (and not the noscript tags). Kim's suggestion is similar except that solution uses Javascript to create the image.


Best of Luck!




petebardo -- Deadhead doing AdWords