2 replies
Hey,

I am trying to setup onclick tracking for analytics on a button within some PHP code but it keeps giving me errors and I don't know why!

Please take a look:

HTML Code:
			if (!VmConfig::get('use_as_catalog')) {
				$checkout_link_html = '<a href="javascript:document.checkoutForm.submit();" class="vm-button-correct"><span>' . $text . '</span></a>';
			} else {
			
				$checkout_link_html = '';
That is the button I need to track, I place the JS tracking before and after the href but it doesn't work!

Please can anyone help?

Thanks

Ricky
#php
  • Profile picture of the author jazoo
    It might be helpful if you post the errors you get.

    There is a '}' missing from the end of the if statement, I'm not sure if this was intentional.
    {{ DiscussionBoard.errors[6004866].message }}
  • Profile picture of the author drmadcow
    Why not track the form submissions as a conversion? The other way will be to trigger the analytics prior to the forum submissions. To do this you'd have to remove that href and change the location to "#", than have the onchange attribute with the analytics code first, than your form submissions javascript (you won't need javascript:, but you will need a , between functions). Cheers.
    {{ DiscussionBoard.errors[6016900].message }}

Trending Topics