http://www.mediawiki.org/wiki/Special:Code/MediaWiki/73578
Revision: 73578
Author: awjrichards
Date: 2010-09-22 22:16:19 +0000 (Wed, 22 Sep 2010)
Log Message:
-----------
Fixed utm_source tracking for cc form (particularly when the form is reached
from something other than a landing page)
Modified Paths:
--------------
trunk/extensions/DonationInterface/payflowpro_gateway/forms/Form.php
trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php
Modified: trunk/extensions/DonationInterface/payflowpro_gateway/forms/Form.php
===================================================================
--- trunk/extensions/DonationInterface/payflowpro_gateway/forms/Form.php
2010-09-22 21:57:58 UTC (rev 73577)
+++ trunk/extensions/DonationInterface/payflowpro_gateway/forms/Form.php
2010-09-22 22:16:19 UTC (rev 73578)
@@ -233,7 +233,7 @@
global $wgRequest;
$hidden_fields = array(
- 'utm_source' => $this->form_data[ 'utm_source'
] . $wgRequest->getText( 'utm_source_id' ),
+ 'utm_source' => $this->form_data[ 'utm_source'
],
'utm_medium' => $this->form_data[ 'utm_medium'
],
'utm_campaign' => $this->form_data[
'utm_campaign' ],
'language' => $this->form_data[ 'language' ],
Modified:
trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php
===================================================================
---
trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php
2010-09-22 21:57:58 UTC (rev 73577)
+++
trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php
2010-09-22 22:16:19 UTC (rev 73578)
@@ -886,7 +886,7 @@
'order_id' => $order_id,
'numAttempt' => $numAttempt,
'referrer' => $wgRequest->getText( 'referrer' ),
- 'utm_source' => $wgRequest->getText(
'utm_source' ),
+ 'utm_source' => $this->getUtmSource(),
'utm_medium' => $wgRequest->getText(
'utm_medium' ),
'utm_campaign' => $wgRequest->getText(
'utm_campaign' ),
'language' => $wgRequest->getText( 'language' ),
@@ -921,4 +921,44 @@
'emailAdd' => '',
);
}
+
+ /**
+ * Get the utm_source string
+ *
+ * Checks to see if the utm_source is set properly for the credit card
+ * form including any cc form variants (identified by utm_source_id).
If
+ * anything cc form related is out of place for the utm_source, this
+ * will fix it.
+ *
+ * @return string The full utm_source
+ */
+ public function getUtmSource() {
+ global $wgRequest;
+
+ // fetch whatever was passed in as the utm_source
+ $utm_source = $wgRequest->getText( 'utm_source' );
+
+ // split the utm_source into its parts for closer examination
+ $source_parts = explode( ".", $utm_source );
+
+ $cc_match = false;
+ $utm_source_id = $wgRequest->getVal( 'utm_source_id' );
+
+ // check the utm_source bits to see if cc has been added yet
+ foreach ( $source_parts as $key => $value ) {
+ if ( preg_match( '/^cc/', $value ) ) {
+ // append utm_source_id if we have it
+ $source_parts[ $key ] = 'cc' . $utm_source_id;
+ $cc_match = true;
+ break;
+ }
+ }
+
+ // if cc hasn't been added yet, add it with the utm_source_id
+ if ( !$cc_match ) {
+ $source_parts[] = 'cc' . $utm_source_id;
+ }
+
+ return implode( ".", $source_parts );
+ }
} // end class
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs