Support » Plugin: Subscribe2 » [Plugin: Subscribe2] Advanced tracking URLs – categories/post IDs?

  • Resolved laga



    first and foremost: let me thank you for your plugin. It is a great way to keep our readers updated and works flawlessly.

    We’ve started to use Piwik Analytics to gain some insight into our site. One of the things I am currently doing is setting up campaign tracking – I want to know how many of our visitors come in via our twitter feed, how many come in via our subscribe2 newsletter etc.

    Now what I’m wondering is if it’s possible, out of the box, to include the post category or even the ID in the tracking parameter, perhaps via additional parsing of variables. With the current way, we only see how many users come in via our email campaign, but we don’t see which postings generate the most interest – if 80% of the clicks are for posts in category A and 20% are for posts in category B, it’d be good to know about this. (Of course, we could consider the global distribution of visitors across categories, but we expect our customers to which we send the emails to click on different things than random visitors)

    Is this currently possible or is it time to brush up on my PHP? It’s also possible that Piwik itself can differentiate between different target URLs for a given URL, but I do not have enough data yet to verify..

    Best regards,


Viewing 2 replies - 1 through 2 (of 2 total)
  • @michael,

    The tracking links in Subscribe2 are static at the moment and simply take string defined in the Settings page. It would require some coding changes to allow thinks like post categories or IDs to be added into the tracking link.


    Untested but this might work, in the class-s2-core.php file and look for the get_tracking_link() function and try replacing it with this. You can then hopefully use {ID} in the tracking section of the Settings page to add ‘&{ID}’ so the post ID is added to the tracked link. Let me know if this works or any changes you need to make to get it working and I’ll add them into the next release.

    function get_tracking_link($link) {
    	if ( empty($link) ) { return; }
    	if ( !empty($this->subscribe2_options['tracking']) ) {
    		(strpos($link, '?') > 0) ? $delimiter .= '&' : $delimiter = '?';
    		if ( strpos($this->subscribe2_options['tracking'], "{ID}") ) {
    			global $post;
    			$tracking = str_replace("{ID}", $post->ID, $this->subscribe2_options['tracking']);
    			return $link . $delimiter . $tracking;
    		return $link . $delimiter . $this->subscribe2_options['tracking'];
    	} else {
    		return $link;
    } // end get_tracking_link()
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Subscribe2] Advanced tracking URLs – categories/post IDs?’ is closed to new replies.