Skip to content

Commit

Permalink
Fixes #4260 Make Campaign name + Keyword lowercase also in the Goal c…
Browse files Browse the repository at this point in the history
…onversion logs + integration test

Thanks for the report!
  • Loading branch information
mattab committed Feb 16, 2014
1 parent 7bd88b8 commit 56cb86a
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 29 deletions.
3 changes: 3 additions & 0 deletions core/Tracker/GoalManager.php
Expand Up @@ -314,6 +314,9 @@ public function recordGoals($idSite, $visitorInformation, $visitCustomVariables,
$time = $referrerTimestamp;
}
}
$name = Common::mb_strtolower($name);
$keyword = Common::mb_strtolower($keyword);

$goal += array(
'referer_type' => $type,
'referer_name' => $name,
Expand Down
2 changes: 1 addition & 1 deletion core/Tracker/Referrer.php
Expand Up @@ -285,10 +285,10 @@ protected function detectReferrerCampaign()
$this->detectReferrerCampaignFromLandingUrl();
$this->detectCampaignKeywordFromReferrerUrl();

// if we detected a campaign but there is still no keyword set, we set the keyword to the Referrer host
if ($this->typeReferrerAnalyzed != Common::REFERRER_TYPE_CAMPAIGN) {
return false;
}
// if we detected a campaign but there is still no keyword set, we set the keyword to the Referrer host
if(empty($this->keywordReferrerAnalyzed)) {
$this->keywordReferrerAnalyzed = $this->referrerHost;
}
Expand Down
Expand Up @@ -14,39 +14,18 @@ class Test_Piwik_Integration_PeriodIsRange_DateIsLastN_MetadataAndNormalAPI exte
{
public static $fixture = null;

static $shouldSkipTestThisTime = false;

public static function setUpBeforeClass()
{
self::$shouldSkipTestThisTime = in_array(date('G'), array(22, 23));

if (self::$shouldSkipTestThisTime) {
print("\nSKIPPED test PeriodIsRange_DateIsLastN_MetadataAndNormalAPI since it fails around midnight...\n");
return;
}

self::$fixture->dateTime = Date::factory('now')->getDateTime();
self::$fixture->dateTime = Date::factory('today')->getDateTime();
parent::setUpBeforeClass();
}

public static function tearDownAfterClass()
{
if (self::$shouldSkipTestThisTime) {
return;
}

parent::tearDownAfterClass();
}

/**
* @dataProvider getApiForTesting
* @group Integration
*/
public function testApi($api, $params)
{
if (self::$shouldSkipTestThisTime) {
return;
}
$this->runApiTests($api, $params);
}

Expand Down Expand Up @@ -84,8 +63,11 @@ public function getApiForTesting()
foreach ($dates as $date) {
$result[] = array($apiToCall, array('idSite' => $idSite, 'date' => $date,
'periods' => array('range'), 'segment' => $segment,
// testing getLastVisitsForVisitor requires a visitor ID
'visitorId' => $visitorId));
// testing getLastVisitsForVisitor requires a visitor ID
'visitorId' => $visitorId,
'otherRequestParameters' => array(
'lastMinutes' => 60 * 24,
)));
}
}

Expand Down
Expand Up @@ -392,4 +392,4 @@


</row>
</result>
</result>
Expand Up @@ -266,4 +266,4 @@
</lastVisits>


</result>
</result>
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<result>
<row>
<label>CAMPAIGN NAME - YEAH!</label>
<label>campaign name - yeah!</label>
<goals>
<row idgoal='1'>
<nb_conversions>1</nb_conversions>
Expand All @@ -14,7 +14,7 @@
<nb_visits>0</nb_visits>
<subtable>
<row>
<label>CAMPAIGN KEYWORD - RIGHT...</label>
<label>campaign keyword - right...</label>
<goals>
<row idgoal='1'>
<nb_conversions>1</nb_conversions>
Expand Down

0 comments on commit 56cb86a

Please sign in to comment.