Syntax error when inserting onClick tag

53 views
Skip to first unread message

Alex M

unread,
Jun 17, 2015, 2:41:27 PM6/17/15
to adwor...@googlegroups.com
I was directed here by a Google Adwords Support member after a lengthy conversation in which she was eventually unable to help me with this code.

Anywho, I am attempting to add an onClick tag to an "Add to Cart" image button so that I can track the conversions of people clicking it.


This code : '<form action="https://www.landscapesupplyco.com/cart/?action=add" method="post"><input type="hidden" name="id" value="'.$id.'"><button type="submit" class="btn btn-block btn-modern">Add to <img style="max-width: 58px;" src="../img/paypal_logo_smb.png" alt="paypal" onClick="goog_report_conversion('https://www.landscapesupplyco.com/cart/')"/> cart<br/>$'.$price.'</button></form>'

is giving me a parse/syntax error and preventing the page from loading (I also tried adding a space between conversion and the beginning parentheses). Even the .pdf download link in the example located here : https://support.google.com/adwords/answer/6095821?hl=en&authuser=0 under "Setting up an onClick handler for conversions" in the image portion results in a syntax error.

What would be the correct code to avoid this error and accurately report conversions of "Add to Cart" clicks? With the given example I'd be surprised if anyone has gotten a click tracking even to report correctly, lol.


Thanks in advance for your help.

Nadine Sundquist (AdWords API Team)

unread,
Jun 17, 2015, 4:12:30 PM6/17/15
to adwor...@googlegroups.com, landscap...@gmail.com
Hi Alex,

I wish I didn't have to redirect you further, but this forum only deals with questions directly related the AdWords API. I would recommend posting to the Tracking and Reporting AdWords forum.  

Thanks,
Nadine, AdWords API Team
Reply all
Reply to author
Forward
0 new messages