Welcome to mirror list, hosted at ThFree Co, Russian Federation.

table_by_dimension.tpl « templates « Goals « plugins - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 84e105f748c39bc48023fd06469bcbfbe41fc104 (plain)
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
<h2 id='titleGoalsByDimension'>{if isset($idGoal)}
	{'Goals_GoalConversionsBy'|translate:$goalName}
	{else}{'Goals_ConversionsOverviewBy'|translate}{/if}</h2> 

<div class='entityList goalDimensions'>
	{if isset($ecommerce)}
	<div class='dimensionCategory'>
		{'Goals_EcommerceReports'|translate}
		<ul class='listCircle'>
		<li class='goalDimension' module='Goals' action='getItemsSku'>
			<span class='dimension'>{'Goals_ProductSKU'|translate}</span>
		</li>
		<li class='goalDimension' module='Goals' action='getItemsName'>
			<span class='dimension'>{'Goals_ProductName'|translate}</span>
		</li>
		</li>
		<li class='goalDimension' module='Goals' action='getItemsCategory'>
			<span class='dimension'>{'Goals_ProductCategory'|translate}</span>
		</li>
		<li class='goalDimension' module='Goals' action='getEcommerceLog'>
			<span class='dimension'>{'Goals_EcommerceLog'|translate}</span>
		</li>
		</ul>
	</div>
	{/if}
	{if $nb_conversions > 0 }
		{foreach from=$goalDimensions key=dimensionFamilyName item=dimensions}
			<div class='dimensionCategory'>
				{'Goals_ViewGoalsBy'|translate:$dimensionFamilyName}
				<ul class='listCircle'>
				{foreach from=$dimensions item=dimension}
					<li title='{'Goals_ViewGoalsBy'|translate:$dimension.name}' class='goalDimension' module='{$dimension.module}' action='{$dimension.action}'>
						<span class='dimension'>{$dimension.name}</span>
					</li>
				{/foreach}
				</ul>
			</div>
		{/foreach}
	{/if}
</div>

<div style='float: left;'>
	{ajaxLoadingDiv id=tableGoalsLoading}
	
	<div id='tableGoalsByDimension'></div>
</div>
<div class="clear"></div>
<script type="text/javascript">
var preloadAbandonedCart = {if $cart_nb_conversions > 0 && $nb_conversions == 0}1{else}0{/if};
{literal}
$(document).ready( function() {
	var countLoaded = 0;
	/* 
	 * For each 'dimension' in the list, a click will trigger an ajax request to load the datatable 
	 * showing Goals metrics (conversion, conv. rates, revenue) for this dimension
	 */
	$('.goalDimension').click( function() {
		var self = this;
		$('.goalDimension').removeClass('activeDimension');
		$(this).addClass('activeDimension');
		var module = $(this).attr('module');
		var action = $(this).attr('action');
		widgetUniqueId = module+action;
		self.expectedWidgetUniqueId = widgetUniqueId;
		
		var widgetParameters = {
			'module': module,
			'action': action
		};
		var idGoal = broadcast.getValueFromHash('idGoal');
		widgetParameters['idGoal'] = idGoal.length ? idGoal : 0; //Piwik_DataTable_Filter_AddColumnsProcessedMetricsGoal::GOALS_FULL_TABLE;
		
		// Loading segment table means loading Goals view for Top Countries/etc.
		if(module != 'Goals') {
			widgetParameters['viewDataTable'] = 'tableGoals';
			// 0 is Piwik_DataTable_Filter_AddColumnsProcessedMetricsGoal::GOALS_FULL_TABLE
			widgetParameters['documentationForGoalsPage'] = 1;
		}
		
		if(preloadAbandonedCart) {
			widgetParameters['viewDataTable'] = 'ecommerceAbandonedCart';
			widgetParameters['filterEcommerce'] = 2;
		}
		var onWidgetLoadedCallback = function (response) {
			if(widgetUniqueId != self.expectedWidgetUniqueId) {
				return;
			}
			$('#tableGoalsByDimension').html($(response));
			$('#tableGoalsLoading').hide();
			$('#tableGoalsByDimension').show();
			
			countLoaded++;
			// only scroll down to the loaded datatable if this is not the first one
			// otherwise, screen would jump down to the table when loading the report 
			if(countLoaded > 1)
			{
				piwikHelper.lazyScrollTo("#titleGoalsByDimension", 400);
			}
		};
		$('#tableGoalsByDimension').hide();
		$('#tableGoalsLoading').show();

		ajaxRequest = widgetsHelper.getLoadWidgetAjaxRequest(widgetUniqueId, widgetParameters, onWidgetLoadedCallback);
		$.ajax(ajaxRequest);
	});
	$('.goalDimension').first().click();
});
</script>
{/literal}