Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This file is part of the Magento Article, How to Add Tracking Links to Magento
- // Please change the default newAction() method with the code below, changing it to your own needs
- public function newAction()
- {
- if ($this->getRequest()->isPost() && $this->getRequest()->getPost('email')) {
- $session = Mage::getSingleton('core/session');
- $email = (string) $this->getRequest()->getPost('email');
- /*
- *
- * OpenX image beacon tracker code
- * - Generated with OpenX v2.8.2-rc25
- *
- * If this tag is being served on a secure (SSL) page, you must replace
- * 'http://d1.openx.org/...'
- * with
- * 'https://d1.openx.org/...'
- *
- * To help prevent caching of this tracker beacon, if possible,
- * Replace %%RANDOM_NUMBER%% with a randomly generated number (or timestamp)
- *
- * In order for the adserver to track variables for this conversion,
- * they must be provided by the client.
- *
- * Additional variables may be added, however they must be added
- * in the adserver as well before they will be logged.
- *
- * The '%%VARIABLE_VALUE%%' should be replaced with the
- * actual values for this sale.
- *
- */
- $timestamp = time();
- $openXtracker = "<div id='m3_tracker_1828' style='position: absolute; left: 0px; top: 0px; visibility: hidden;'><img src='http://d1.openx.org/ti.php?trackerid=1828&email=$email&cb=$timestamp' width='0' height='0' alt='' /></div>";
- // EuroAds Tracking code
- $euroadsTracker = "<iframe src='http://www.euroads.dk/system/showtrackingpixels.php?cpid=2125&sid=1&orderid=$email&pgid=96' width='1' height='1' marginwidth='0' marginheight='0' allowtransparency='true' frameborder='0' scrolling='no' hspace='0' vspace='0'></iframe>";
- try {
- if (!Zend_Validate::is($email, 'EmailAddress')) {
- Mage::throwException($this->__('Please enter a valid email address'));
- }
- $status = Mage::getModel('newsletter/subscriber')->subscribe($email);
- if ($status == Mage_Newsletter_Model_Subscriber::STATUS_NOT_ACTIVE) {
- $session->addSuccess($this->__('Confirmation request has been sent') . $openXtracker . $euroadsTracker);
- }
- else {
- $session->addSuccess($this->__('Thank you for your subscription') . $openXtracker . $euroadsTracker);
- }
- }
- catch (Mage_Core_Exception $e) {
- $session->addException($e, $this->__('There was a problem with the subscription: %s', $e->getMessage()));
- }
- catch (Exception $e) {
- $session->addException($e, $this->__('There was a problem with the subscription'));
- }
- }
- $this->_redirectReferer();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement