Move busui to seperate repository
[bus.git] / report_traffic.tpl
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<div class="owa_reportSectionContent">
	<div id="trend-chart" style="height:125px; min-width:400px;padding-right:30px;"></div>
</div>
<div class="owa_reportSectionContent">
	<div id="visits-headline" class="owa_reportSectionHeader"></div> 

	<table style="width:100%;margin-top:-15px;">
		<TR>
			<TD valign="top" style="width:50%;">
				<div id="traffic-sources" style="width:250px;"></div>
			</TD>
			
			<TD valign="top" style="width:50%;">
				<div id="trend-metrics"></div>
			</TD>
			
		</TR>
	</table>
</div>

<table style="width:auto;margin-top:;">
	<tr>
		<td valign="top" style="width:50%;">
		
		<div class="owa_reportSectionContent">
		
			<div class="owa_reportSectionContent" style="min-width:350px;">
				<div class="owa_reportSectionHeader">Top Sources</div>
				
				<div id="top-sources"></div>
				<div class="owa_genericHorizonalList owa_moreLinks">
					<UL>
						<LI>
							<a href="<?php echo $this->makeLink(array('do' => 'base.reportSources'), true);?>">View Full Report &raquo;</a>	
						</LI>
					</UL>
				</div>
			</div>
		
			<div class="owa_reportSectionHeader">Related Reports</div>
				<div class="relatedReports">
					<UL>
						<LI>
							<a href="<?php echo $this->makeLink(array('do' => 'base.reportSearchEngines'));?>">Search Engines</a></span> - See which search engines your visitors are coming from.
						</LI>
						<LI>
							<a href="<?php echo $this->makeLink(array('do' => 'base.reportKeywords'));?>">Keywords</a></span> - See what keywords your visitor are using to find your web site.
						</LI>
						<LI>
							<a href="<?php echo $this->makeLink(array('do' => 'base.reportReferringSites'));?>">Referring Web Sites</a></span> - See which web sites are linking to your web site.
						</LI>
						<LI>
							<a href="<?php echo $this->makeLink(array('do' => 'base.reportAnchortext'));?>">Inbound Link Text</a></span> - See what words Referring Web Sites use to describe your web site.
						</LI>
					</UL>
				</div>
			</div>
		
			<div class="owa_reportSectionContent" style="min-width:350px;">
				<div class="owa_reportSectionHeader">Top Keywords</div>
				
				<div id="top-keywords"></div>
				<div class="owa_genericHorizonalList owa_moreLinks">
					<UL>
						<LI>
							<a href="<?php echo $this->makeLink(array('do' => 'base.reportKeywords'), true);?>">View Full Report &raquo;</a>	
						</LI>
					</UL>
				</div>
			</div>
		
		</td>
		
		<td valign="top" style="width:50%;">
			
			<div class="owa_reportSectionContent" style="min-width:350px;">
				<div class="owa_reportSectionHeader">Top Referrals</div>
				<div id="top-referrals"></div>
				<div class="owa_genericHorizonalList owa_moreLinks">
					<UL>
						<LI>
							<a href="<?php echo $this->makeLink(array('do' => 'base.reportReferringSites'), true);?>">View Full Report &raquo;</a>	
						</LI>
					</UL>
				</div>
			</div>
		</td>
	</tr>
</table>




<script>
//OWA.setSetting('debug', true);

var aurl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet', 
												'metrics' => 'visits', 
												'dimensions' => 'date', 
												'sort' => 'date',
												'format' => 'json',
												'constraints' => urlencode($this->substituteValue('siteId==%s,','siteId'))), true);?>';
												  
OWA.items.rsh = new OWA.resultSetExplorer('trend-chart');
OWA.items.rsh.asyncQueue.push(['makeAreaChart', [{x:'date',y:'visits'}]]);
OWA.items.rsh.asyncQueue.push(['renderTemplate','#visits-headline-template', {data: OWA.items.rsh}, 'replace', 'visits-headline']);
OWA.items.rsh.load(aurl);

var tturl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet', 
														'metrics' => 'visits', 
														'dimensions' => 'date,medium', 
														'sort' => 'date',
														'format' => 'json',
														'constraints' => urlencode($this->substituteValue('siteId==%s,', 'siteId').',medium=@organic')),true);?>';
																	  
OWA.items.tt = new OWA.resultSetExplorer('trend-metrics');
OWA.items.tt.asyncQueue.push(['makeMetricBoxes','','','Visits From Search Engines', '',function(row) {if (row.medium.value === 'organic-search') return true;}]);
OWA.items.tt.load(tturl);

var tt1url = '<?php echo $this->makeApiLink(array('do' => 'getResultSet', 
														'metrics' => 'visits', 
														'dimensions' => 'date', 
														'sort' => 'date',
														'format' => 'json',
														'constraints' => urlencode($this->substituteValue('siteId==%s,', 'siteId')).'medium==direct'),true);?>';
																	  
var tt1 = new OWA.resultSetExplorer('trend-metrics');
tt1.asyncQueue.push(['makeMetricBoxes','','','Visits From Direct Navigation']);
tt1.load(tt1url);


var tt2url = '<?php echo $this->makeApiLink(array('do' => 'getResultSet', 
														'metrics' => 'visits', 
														'dimensions' => 'date', 
														'sort' => 'date',
														'format' => 'json',
														'constraints' => urlencode($this->substituteValue('siteId==%s,','siteId')).'medium==referral'),true);?>';
														  
OWA.items.tt2 = new OWA.resultSetExplorer('trend-metrics');

OWA.items.tt2.asyncQueue.push(['makeMetricBoxes','','','Visits From Referrals']);
OWA.items.tt2.load(tt2url);

var vmurl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet', 
																	'metrics' => 'visits', 
																	'dimensions' => 'medium', 
																	'sort' => 'visits-',
																	'format' => 'json',
																	'constraints' => urlencode($this->substituteValue('siteId==%s,','siteId'))),true);?>';
																	  
OWA.items.vm = new OWA.resultSetExplorer('traffic-sources');
OWA.items.vm.options.pieChart.metric = 'visits';
OWA.items.vm.options.pieChart.dimension = 'medium';
OWA.items.vm.options.chartWidth = '300px';
OWA.items.vm.asyncQueue.push(['makePieChart']);
OWA.items.vm.load(vmurl);


var topkeywordsurl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet', 
												'metrics' => 'visits', 
												'dimensions' => 'referralSearchTerms', 
												'sort' => 'visits-',
												'format' => 'json',
												'resultsPerPage' => 25,
												'constraints' => urlencode($this->substituteValue('siteId==%s,','siteId'))), true);?>';
												  
OWA.items.topkeywords = new OWA.resultSetExplorer('top-keywords');
OWA.items.topkeywords.addLinkToColumn('referralSearchTerms', '<?php echo $this->makeLink(array('do' => 'base.reportKeywordDetail', 'referralSearchTerms' => '%s'), true);?>', ['referralSearchTerms']);
OWA.items.topkeywords.asyncQueue.push(['refreshGrid']);
OWA.items.topkeywords.load(topkeywordsurl);

var topreferralsurl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet', 
												'metrics' => 'visits', 
												'dimensions' => 'referralPageUrl', 
												'sort' => 'visits-',
												'format' => 'json',
												'resultsPerPage' => 25,
												'constraints' => urlencode($this->substituteValue('siteId==%s,','siteId'))), true);?>';
												  
OWA.items.topreferrals = new OWA.resultSetExplorer('top-referrals');
OWA.items.topreferrals.addLinkToColumn('referralPageUrl', '<?php echo $this->makeLink(array('do' => 'base.reportReferralDetail', 'referralPageUrl' => '%s'),true);?>', ['referralPageUrl']);
OWA.items.topreferrals.asyncQueue.push(['refreshGrid', 'top-referrals']);
OWA.items.topreferrals.load(topreferralsurl);

var topsources_url = '<?php echo $this->makeApiLink(array(
		'do' => 'getResultSet', 
		'metrics' => 'visits', 
		'dimensions' => 'source,medium', 
		'sort' => 'visits-',
		'format' => 'json',
		'resultsPerPage' => 25,
		'constraints' => urlencode($this->substituteValue('siteId==%s,','siteId'))), true);?>';
												  
OWA.items.topsources = new OWA.resultSetExplorer('top-sources');
OWA.items.topsources.addLinkToColumn('source', '<?php echo $this->makeLink(array('do' => 'base.reportSourceDetail', 'source' => '%s' , 'medium' => '%s'),true);?>', ['source', 'medium']);
OWA.items.topsources.asyncQueue.push(['refreshGrid', 'top-sources']);
OWA.items.topsources.load(topsources_url);


</script>

<?php require_once('js_report_templates.php');?>

<script type="text/x-jqote-template" id="visits-headline-template">
<![CDATA[
	There were <*= this.data.resultSet.aggregates.visits.formatted_value *> <* if (this.data.resultSet.aggregates.visits.value > 1) {this.label = 'visits';} else {this.label = 'visit';} *> <*= this.label *> from all mediums.
]]> 
</script>