Support » Plugin: Google Analytics for WordPress by MonsterInsights » trackEvent Download – Not working on Custom Post Type

  • cdodge

    (@cdodgenewbcomputerbuildcom)


    Hello,

    I’m using the plugin and everything works just fine including tracking download events throughout my site in my google analytics, however the exception seems to be a custom post type of mine.

    The links I am trying to track are downloadable PDFs that I import using a custom post type field. I then call the medias URL in my template as a link.

    I call the link as such –

    <p><b>Download PDF:</b> <a href="<?php echo $url; ?>"><?php echo the_title(); ?></a></p>

    With the resulting link –

    <p><b>Download PDF:</b> <a href="http://document.pdf">Document Title</a></p>

    I’m unsure as to why the trackEvent code is not being attached to this download link?

    https://wordpress.org/plugins/google-analytics-for-wordpress/

Viewing 1 replies (of 1 total)
  • Hi, just want to know if you’ve found a solution because I’ve got the same issue: If I insert a pdf file in a content box, the onclick event is injected but If I create a link to… the same pdf, from an archive of a custom post type (archive-articles.php for cpt articles), no onclick is being injected.

    Thanks

Viewing 1 replies (of 1 total)
  • The topic ‘trackEvent Download – Not working on Custom Post Type’ is closed to new replies.