I have the following script attached to a button:
<script type="text/javascript">
$('.addToCartButton').click(function() {
fbq('track', 'AddToCart', {
content_ids: ['<?php echo (int)$product_info['products_id']; ?>'],
content_type: 'product'
});
});
</script>
I am trying to activate the facebook addtocart on button click.
The button code is:
<button id="tdb1" type="submit" class="addToCartButton" role="button" aria-disabled="false">
<span class="ui-button-icon-primary ui-icon ui-icon-cart"></span>
<span class="ui-button-text">Add to Cart</span>
</button>
Is there a way to check if it is firing in chrome dev tools? Am I missing something?
Add a debugger
statement before and after the click
function and make sure that the developer console is open.
The console will break at the debugger
statement and you can debug from there.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.