Link to home
Start Free TrialLog in
Avatar of Crazy Horse
Crazy HorseFlag for South Africa

asked on

Google analytics not picking up custom post type

I have installed a basic google analytics plugin and for the most part it works. It tracks all the pages and taxonomies but not the custom post type. So, once you drill down on the actual website to:

https://example.com/product/some-category/some-item

In google analytics it only goes as far as:

https://example.com/product/some-category/

leaving off the item.

When I view the source of the custom post type product item page, I can see that the tracking code is there.

Does anyone know why this might be happening?

Post type:

register_post_type('product', array(
'supports'      => array('title', 'editor', 'thumbnail', 'excerpt'),
'rewrite'       => array('slug' => 'product'),
'has_archive'   => true,
'public'        => true,
'labels'        => array(
        'name'         => 'Products',
        'add_new_item' => 'Add New Product',
        'edit_item'    => 'Edit Product', 
        'all_items'    => 'All Products',
),
'menu_icon'     => 'dashicons-cart'
));

Open in new window



Plugin used:

https://wordpress.org/plugins/ga-google-analytics/
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.