Hey guys,
i have a question regarding the catalogue element and the possibility to track onclick conversions for AdWords. Obviously, the catalogue element is made to show items/products/prices whatever and then adding a link to bring them to the desired item. On this link click i want to add an onclick event to track those conversions (visit site => click link in catalogue) and send them back to AdWords.
Can you help me figuring out how to do this or what to adapt?
Thank you very much!
Hey nerlub,
You could use a function to track your events, like this. But you’ll need the right events, this is an example.
function add_custom_script(){
?>
<script>
jQuery(window).load(function(){
jQuery(‘.ga-buy-1 a’).attr(‘onclick’, ‘ga(\’send\’, \’event\’, \’Buy Button\’, \’item1\’)\;’);
jQuery(‘.ga-buy-2 a’).attr(‘onclick’, ‘ga(\’send\’, \’event\’, \’Buy Button\’, \’item2\’)\;’);
jQuery(‘.ga-buy-3 a’).attr(‘onclick’, ‘ga(\’send\’, \’event\’, \’Buy Button\’, \’item3\’)\;’);
});
</script>
<?php
}
add_action(‘wp_footer’, ‘add_custom_script’);
Best regards,
Mike