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

How to trigger conversion code inside of jquery ajx method

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

I'm trying to call the conversion code inside of a jquery ajx method inside of the success block.

 

here is my code:

$.ajax({
type: "POST",
url: "scripts/process-step3.php",
data: $('#step2').serialize(),
success: function(msg){
var google_conversion_id = xxxxxxxxxx;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "yyyyyyyyyyyyyyyyyyy";
var google_remarketing_only = false;
$("#adwords").append('<div style="display:inline;"><img height="1" width="1" style="border- style:none;" alt=" src="http://www.googleadservices.com/pagead/conversion/xxxxxxxxxx/? value=0&amp;amp;label=yyyyyyyyyyyyyyyyyyy&amp;amp;guid=ON&amp;amp;script=0"/></div>');
}
});

 Here is the output

<div style="display:inline;">
     <img height="1" width="1" style="border-style:none;" alt=" src=" http:=""    www.googleadservices.com="" pagead="" conversion="" xxxxxxxxxx="" ?  value="0&amp;amp;label=yyyyyyyyyyyyyyyyyyy&amp;amp;guid=ON&amp;amp;script=0&quot;/">
</div>

 

 

 

 

 

 

 

 

1 Expert replyverified_user

Re: How to trigger conversion code inside of jquery ajx method

Top Contributor
# 2
Top Contributor
Hi Aaron.
I don't believe that you're going about this the right way.

First of all, the output IMGSRC is not formatted correctly. I have no idea what exactly you're trying to do there but you're not requesting the image correctly.

You're making it way more complicated than it needs to be.

Just call the .gif image. Simple as that. You've broken the image call up into many different sections that make no sense. Keep it simple.

I suggest that you ask over on stackoverflow for some help on calling the image from your specific setup.