Hey @jasonbnorth,
Thanks for writing in with your question!
We’re currently listening for two specific WooCommerce actions to track product ViewContent events. These are:
// ViewContent for individual products
add_action( 'woocommerce_after_single_product', [ $this, 'inject_view_content_event' ] );
add_action( 'woocommerce_after_single_product', [ $this, 'maybe_inject_search_event' ] );
Could you confirm for me that your theme is currently using these for the plugin to track correctly?
Cheers!
Simon.
Ok thank you. Which PHP file is that code usually in?
Hi @jasonbnorth,
As we’re not familiar with the theme that you’re using, I’m afraid that we can’t point you to a specific file in your theme. However, what I would recommend is searching your theme files for woocommerce_after_single_product, which should help you narrow it down.
Could you please give this a try and let me know what you find?
Thanks,
Jennifer
It doesn’t look like that hook is being used in any theme file, that I can tell.
Hi @jasonbnorth,
In this case, I’d like to check to see if you have any WooCommerce template overrides in your theme files. You can check this by navigating to your theme files and looking for a “wooCommerce” folder. This article in the WooCommerce documentation has some additional details on template overrides and may be helpful in getting a better understanding of how these work, if you find these overrides in your theme folder.
Could you please let me know if you find any overrides, and if so, which files are listed in that “woocommerce” folder?
Thanks,
Jennifer
Ok I will do that, thank you! Meanwhile I will go ahead and close this ticket. My purpose in figuring this out was to make sure my Dynamic Product Ads would work. At first I thought that ViewContent might need to be tracked in order for Facebook to know which product content a visitor actually views, but it seems that all my products are ready for Dynamic Product Ads according to FB Ads Manager.
I guess I should ask, do you know if ViewContent needs to be tracked in order for Dynamic Product Ads to work?
Hi @jasonbnorth,
I’m afraid that I am not too familiar with Dynamic Product Ads, as this is beyond the scope of what our plugin does, but I did a quick search for you – it does look like tracking this event is required for Dynamic Product Ads.
Once you’ve had a chance to look for any overrides, could you please let me know what you find? It would also be a good idea to try disabling all other plugins besides WooCommerce and Facebook for WooCommerce to see if this issue is still present, as other plugins can also interfere with the default WooCommerce product pages.
Thanks,
Jennifer
Sounds good. I am seeing the woocommerce_after_single_product hook being called in my content-single-product.php WooCommerce template file, which is not being overwritten in my theme files, that I can tell. Definitely also not seeing inject ViewContent function in any of my template files.
Hi @jasonbnorth,
Awesome – since the hook is there, I’d recommend installing and activating the free Query Monitor plugin, which will allow you to see which functions are being run on those hooks on any given page.
So, once the plugin is installed and activated, you can go to one of your product pages on the front end (while logged in as an admin), select the Query Monitor menu from the top admin bar, and click on the “Hooks & Actions” option from the menu that appears. This should look like this:

With that open, you can do a page search for those hooks and see which functions are hooked in. Could you please send me a screenshot of what you see for each of these hooks?
Thanks,
Jennifer
Ok thanks! Yeah I got our developer to check it out and made sure the hook was being called, so ViewContent is tracking now, thanks!
Hi @jasonbnorth,
Great! I’m glad to hear that it’s working now. 🙂 If you run into any further issues or have any other questions, please don’t hesitate to reach out. We are happy to help.
Thanks,
Jennifer