Google Analytics by MonsterInsights
trackEvent Download - Not working on Custom Post Type (2 posts)

  1. cdodge
    Posted 2 years ago #


    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?


  2. ericthibeault
    Posted 1 year ago #

    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.


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Google Analytics by MonsterInsights
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic