doTrackGoal() public method

Records a Goal conversion
public doTrackGoal ( integer $idGoal, float $revenue ) : mixed
$idGoal integer Id Goal to record a conversion
$revenue float Revenue for this conversion
return mixed Response or true if using bulk request
Ejemplo n.º 1
0
 public function setupAction()
 {
     if ($this->getD2EM()->getRepository('\\Entities\\Admin')->getCount() != 0) {
         $this->addMessage(_("Admins already exist in the system."), OSS_Message::INFO);
         $this->_redirect('auth/login');
     }
     if ($this->getAuth()->getIdentity()) {
         $this->addMessage(_('You are already logged in.'), OSS_Message::INFO);
         $this->_redirect('domain/list');
     }
     $this->view->form = $form = new ViMbAdmin_Form_Admin_AddEdit();
     $form->removeElement('active');
     $form->removeElement('super');
     $form->removeElement('welcome_email');
     if (!isset($this->_options['securitysalt']) || strlen($this->_options['securitysalt']) != 64) {
         $this->view->saltSet = false;
         $randomSalt = $this->view->randomSalt = OSS_String::salt(64);
         $form->getElement('salt')->setValue($randomSalt);
         $this->view->rememberSalt = OSS_String::salt(64);
         $this->view->passwordSalt = OSS_String::salt(64);
     } else {
         $this->view->saltSet = true;
         if ($this->getRequest()->isPost() && $form->isValid($_POST)) {
             if ($form->getElement('salt')->getValue() != $this->_options['securitysalt']) {
                 $this->addMessage(_("Incorrect security salt provided. Please copy and paste it from the <code>application.ini</code> file."), OSS_Message::INFO);
             } else {
                 $admin = new \Entities\Admin();
                 $admin->setUsername($form->getValue('username'));
                 $admin->setPassword(OSS_Auth_Password::hash($form->getValue('password'), $this->_options['resources']['auth']['oss']));
                 $admin->setSuper(true);
                 $admin->setActive(true);
                 $admin->setCreated(new \DateTime());
                 $admin->setModified(new \DateTime());
                 $this->getD2EM()->persist($admin);
                 // we need to populate the Doctine migration table
                 $dbversion = new \Entities\DatabaseVersion();
                 $dbversion->setVersion(ViMbAdmin_Version::DBVERSION);
                 $dbversion->setName(ViMbAdmin_Version::DBVERSION_NAME);
                 $dbversion->setAppliedOn(new \DateTime());
                 $this->getD2EM()->persist($dbversion);
                 $this->getD2EM()->flush();
                 try {
                     $mailer = $this->getMailer();
                     $mailer->setSubject(_('ViMbAdmin :: Your New Administrator Account'));
                     $mailer->addTo($admin->getUsername());
                     $mailer->setFrom($this->_options['server']['email']['address'], $this->_options['server']['email']['name']);
                     $this->view->username = $admin->getUsername();
                     $this->view->password = $form->getValue('password');
                     $mailer->setBodyText($this->view->render('admin/email/new_admin.phtml'));
                     $mailer->send();
                 } catch (Zend_Mail_Exception $e) {
                     $this->addMessage(_('Could not send welcome email to the new administrator. 
                         Please ensure you have configured a mail relay server in your <code>application.ini</code>.'), OSS_Message::ALERT);
                 }
                 $this->addMessage(_('Your administrator account has been added. Please log in below.'), OSS_Message::SUCCESS);
             }
             if (!(isset($this->_options['skipInstallPingback']) && $this->_options['skipInstallPingback'])) {
                 try {
                     // Try and track new installs to see if it is worthwhile continuing development
                     include_once APPLICATION_PATH . '/../public/PiwikTracker.php';
                     if (class_exists('PiwikTracker')) {
                         if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
                             PiwikTracker::$URL = 'https://stats.opensolutions.ie/';
                         } else {
                             PiwikTracker::$URL = 'http://stats.opensolutions.ie/';
                         }
                         $piwikTracker = new PiwikTracker($idSite = 5);
                         $piwikTracker->doTrackPageView('New V3 Install Completed');
                         $piwikTracker->doTrackGoal($idGoal = 2, $revenue = 1);
                     }
                 } catch (Exception $e) {
                 }
             }
             $this->_redirect('auth/login');
         }
     }
 }
<?php

// Example file to demonstrate PiwikTracker.php
// See http://piwik.org/docs/tracking-api/
require_once '../../libs/PiwikTracker/PiwikTracker.php';
PiwikTracker::$URL = 'http://localhost/trunk/';
$piwikTracker = new PiwikTracker($idSite = 1);
// You can manually set the Visitor details (resolution, time, plugins)
// See all other ->set* functions available in the PiwikTracker class
$piwikTracker->setResolution(1600, 1400);
// Sends Tracker request via http
$piwikTracker->doTrackPageView('Document title of current page view');
// You can also track Goal conversions
$piwikTracker->doTrackGoal($idGoal = 1, $revenue = 42);
echo 'done';
Ejemplo n.º 3
0
 public function setupAction()
 {
     $form = new ViMbAdmin_Form_Admin_Edit();
     $form->removeElement('active');
     $form->removeElement('super');
     $form->removeElement('welcome_email');
     if ($this->getAuth()->getIdentity()) {
         $this->addMessage(_('You are already logged in.'), ViMbAdmin_Message::INFO);
         $this->_redirect('domain/list');
     }
     if ($this->_options['securitysalt'] == '') {
         $charSet = 'abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
         $randomSalt = substr(str_shuffle("{$charSet}{$charSet}"), 0, 31);
         // please note this is not UTF-8 compatible
         $this->view->saltSet = false;
         $this->view->randomSalt = $randomSalt;
         $form->getElement('salt')->setValue($randomSalt);
     } elseif (!AdminTable::isEmpty()) {
         $this->addMessage(_("Admins already exist in the system."), ViMbAdmin_Message::INFO);
         $this->_redirect('auth/login');
     } else {
         $this->view->saltSet = true;
         if ($this->getRequest()->isPost() && $form->isValid($_POST)) {
             if ($form->getElement('salt')->getValue() != $this->_options['securitysalt']) {
                 $this->addMessage(_("Incorrect security salt provided. Please copy and paste it from the <code>application.ini</code> file."), ViMbAdmin_Message::INFO);
             } else {
                 $admin = new Admin();
                 $admin['username'] = $form->getValue('username');
                 $admin->setPassword($form->getValue('password'), $this->_options['securitysalt'], false);
                 $admin->super = true;
                 $admin->active = true;
                 $admin->save();
                 try {
                     $mailer = new Zend_Mail();
                     $mailer->setSubject(_('ViMbAdmin :: Your New Administrator Account'));
                     $mailer->addTo($admin['username']);
                     $mailer->setFrom($this->_options['server']['email']['address'], $this->_options['server']['email']['name']);
                     $this->view->username = $admin['username'];
                     $this->view->password = $form->getValue('password');
                     $mailer->setBodyText($this->view->render('admin/email/new_admin.phtml'));
                     $mailer->send();
                 } catch (Exception $e) {
                 }
                 $this->addMessage(_('Your administrator account has been added. Please log in below.'), ViMbAdmin_Message::SUCCESS);
             }
             // Try and track new installs to see if it is worthwhile continueing development
             include_once APPLICATION_PATH . '/../public/PiwikTracker.php';
             if (class_exists('PiwikTracker')) {
                 if ($_SERVER['HTTPS'] == 'on') {
                     PiwikTracker::$URL = 'https://stats.opensolutions.ie/';
                 } else {
                     PiwikTracker::$URL = 'http://stats.opensolutions.ie/';
                 }
                 $piwikTracker = new PiwikTracker($idSite = 5);
                 $piwikTracker->doTrackPageView('Nes Install Completed');
                 $piwikTracker->doTrackGoal($idGoal = 1, $revenue = 0);
             }
             $this->_helper->viewRenderer->setNoRender(true);
             $this->_redirect('auth/login');
         }
     }
     $this->view->form = $form;
 }