- Implements open tracking

This commit is contained in:
Vlad
2016-04-19 20:59:27 -04:00
parent 15cf087d40
commit 45b933d635
7 changed files with 47 additions and 40 deletions

View File

@ -2,12 +2,14 @@
namespace MailPoet\Newsletter\Renderer\PostProcess;
class OpenTracking {
static function process($template, $user_id) {
static function process($template) {
$DOM = new \pQuery();
$DOM = $DOM->parseStr($template);
$template = $DOM->query('body');
$open_tracking_link = sprintf(
'<img alt="" src="%s/?mailpoet&endpoint=track&action=open&data=[mailpoet_data]',
home_url()
'<img alt="" class="" src="%s/%s"/>',
home_url(),
htmlentities('?mailpoet&endpoint=track&action=open&data=[mailpoet_data]')
);
$template->html($template->html() . $open_tracking_link);
return $DOM->__toString();