Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php
/**
* Piwik - Open source web analytics
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
* @version $Id$
*/
/**
* Tests that filter_truncate works recursively in Page URLs report AND in the case there are 2 different data Keywords -> search engine
*/
class Test_Piwik_Integration_OneVisitor_LongUrlsTruncated extends IntegrationTestCase
{
protected static $dateTime = '2010-03-06 01:22:33';
protected static $idSite = 1;
/**
* @dataProvider getApiForTesting
* @group Integration
* @group OneVisitor_LongUrlsTruncated
*/
public function testApi($api, $params)
{
$this->runApiTests($api, $params);
}
public function getApiForTesting()
{
$apiToCall = array('Referers.getKeywords', 'Actions.getPageUrls');
return array(
array($apiToCall, array('idSite' => self::$idSite,
'date' => self::$dateTime,
'language' => 'fr',
'otherRequestParameters' => array('expanded' => 1, 'filter_truncate' => 2)))
);
}
public function getOutputPrefix()
{
return 'OneVisitor_LongUrlsTruncated';
}
protected function setUpWebsitesAndGoals()
{
$this->createWebsite(self::$dateTime);
}
protected function trackVisits()
{
// tests run in UTC, the Tracker in UTC
$dateTime = self::$dateTime;
$idSite = self::$idSite;
// Visit 1: keyword and few URLs
$t = $this->getTracker($idSite, $dateTime, $defaultInit = true, $useThirdPartyCookie = 1);
$t->setUrlReferrer('http://bing.com/search?q=Hello world');
// Generate a few page views that will be truncated
$t->setUrl('http://example.org/category/Page1');
$this->checkResponse($t->doTrackPageView('Hello'));
$t->setUrl('http://example.org/category/Page2');
$this->checkResponse($t->doTrackPageView('Hello'));
$t->setUrl('http://example.org/category/Page3');
$this->checkResponse($t->doTrackPageView('Hello'));
$t->setUrl('http://example.org/category/Page3');
$this->checkResponse($t->doTrackPageView('Hello'));
$t->setUrl('http://example.org/category/Page4');
$this->checkResponse($t->doTrackPageView('Hello'));
$t->setUrl('http://example.org/category/Page4');
$this->checkResponse($t->doTrackPageView('Hello'));
$t->setUrl('http://example.org/category/Page4');
$this->checkResponse($t->doTrackPageView('Hello'));
$t->setUrl('http://example.org/category.htm');
$this->checkResponse($t->doTrackPageView('Hello'));
$t->setUrl('http://example.org/page.htm');
$this->checkResponse($t->doTrackPageView('Hello'));
$t->setUrl('http://example.org/index.htm');
$this->checkResponse($t->doTrackPageView('Hello'));
$t->setUrl('http://example.org/page.htm');
$this->checkResponse($t->doTrackPageView('Hello'));
$t->setUrl('http://example.org/page.htm');
$this->checkResponse($t->doTrackPageView('Hello'));
$t->setUrl('http://example.org/contact.htm');
$this->checkResponse($t->doTrackPageView('Hello'));
// VISIT 2 = Another keyword
$t->setForceVisitDateTime(Piwik_Date::factory($dateTime)->addHour(1)->getDatetime());
$t->setUrlReferrer('http://www.google.com.vn/url?q=Salut');
$this->checkResponse($t->doTrackPageView('incredible title!'));
// Visit 3 = Another keyword
$t->setForceVisitDateTime(Piwik_Date::factory($dateTime)->addHour(2)->getDatetime());
$t->setUrlReferrer('http://www.google.com.vn/url?q=Kia Ora');
$this->checkResponse($t->doTrackPageView('incredible title!'));
// Visit 4 = Kia Ora again
$t->setForceVisitDateTime(Piwik_Date::factory($dateTime)->addHour(3)->getDatetime());
$t->setUrlReferrer('http://www.google.com.vn/url?q=Kia Ora');
$this->checkResponse($t->doTrackPageView('incredible title!'));
// Visit 5 = Another search engine
$t->setForceVisitDateTime(Piwik_Date::factory($dateTime)->addHour(4)->getDatetime());
$t->setUrlReferrer('http://nz.search.yahoo.com/search?p=Kia Ora');
$this->checkResponse($t->doTrackPageView('incredible title!'));
// Visit 6 = Another search engine
$t->setForceVisitDateTime(Piwik_Date::factory($dateTime)->addHour(5)->getDatetime());
$t->setUrlReferrer('http://images.search.yahoo.com/search/images;_ylt=A2KcWcNKJzF?p=Kia%20Ora%20');
$this->checkResponse($t->doTrackPageView('incredible title!'));
// Visit 7 = Another search engine
$t->setForceVisitDateTime(Piwik_Date::factory($dateTime)->addHour(6)->getDatetime());
$t->setUrlReferrer('http://nz.bing.com/images/search?q=+++Kia+ora+++');
$this->checkResponse($t->doTrackPageView('incredible title!'));
}
}