<?php

/*
  MailBeez Automatic Trigger Email Campaigns
  http://www.mailbeez.com

  Copyright (c) 2010, 2011 MailBeez

  inspired and in parts based on
  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License

  rewrite emails to add tracking code

  $ga = new googleAnalytics('medium', 'campaign', 'source');
  $nInfo->content = $ga->rewriteContent($nInfo, 'content');

  // or
  $ga = new googleAnalytics($medium, $campaign, $source);
  $content = $ga->rewriteContent($content);
 */

///////////////////////////////////////////////////////////////////////////////
///																																					 //
///                 MailBeez Core file - do not edit                         //
///                                                                          //
///////////////////////////////////////////////////////////////////////////////

require_once(MH_DIR_FS_CATALOG . MH_ROOT_PATH . 'common/classes/analytics_base.php');

class googleAnalytics extends analyticsBase
{

// class constructor
    function __construct($medium = MAILBEEZ_MAILHIVE_GA_MEDIUM, $campaign = 'newslettername', $source = MAILBEEZ_MAILHIVE_GA_SOURCE)
    {
        parent::__construct();
        $this->medium = $medium;
        $this->campaign = $campaign;
        $this->source = $source;
        $this->buildCode();
        $this->rewrite_format = mh_cfg('MAILBEEZ_MAILHIVE_GA_REWRITE_FORMAT');
    }


    function googleAnalytics($medium = MAILBEEZ_MAILHIVE_GA_MEDIUM, $campaign = 'newslettername', $source = MAILBEEZ_MAILHIVE_GA_SOURCE)
    {
        self::__construct($medium, $campaign, $source);
    }

    function buildCode()
    {
        $this->code = 'utm_source=' . urlencode($this->source) . '&utm_medium=' . urlencode($this->medium) . '&utm_campaign=' . urlencode($this->campaign);
    }
}