diff --git a/src/Pluf/AB/Funnel.php b/src/Pluf/AB/Funnel.php index 9f54c1d..ab74ffc 100644 --- a/src/Pluf/AB/Funnel.php +++ b/src/Pluf/AB/Funnel.php @@ -147,6 +147,12 @@ class Pluf_AB_Funnel return array(); } $t1 = $steps[1]['total']; + $tprops = array(); + foreach ($steps[1]['props'] as $v => $t) { + $tprops[$v] = $t; // some properties are set only in the + // middle of the funnel, we get the + // value in the step. + } for ($i=2;$i<=20;$i++) { if ($steps[$i] and $steps[$i-1]) { $tp = $steps[$i-1]['total']; @@ -155,14 +161,20 @@ class Pluf_AB_Funnel $steps[$i]['conv1'] = sprintf('%01.2f%%', 100.0 - (float)($t1-$tn)/$t1*100.0); if ($prop) { $steps[$i]['sprops'] = array(); + $steps[$i]['sprops1'] = array(); foreach ($steps[$i]['props'] as $v => $t) { + if (!isset($tprops[$v])) { + $tprops[$v] = $t; + } $pv = isset($steps[$i-1]['props'][$v]) ? $steps[$i-1]['props'][$v] : 0; $steps[$i]['sprops'][$v] = array($t, $pv); + $steps[$i]['sprops1'][$v] = array($t, $tprops[$v]); if ($pv) { $steps[$i]['sprops'][$v][] = round(100*(float)$t/(float)$pv,2).'%'; } else { $steps[$i]['sprops'][$v][] = 0; } + $steps[$i]['sprops1'][$v][] = round(100*(float)$t/(float)$tprops[$v],2).'%'; } } } diff --git a/src/Pluf/templates/pluf/ab/base.html b/src/Pluf/templates/pluf/ab/base.html index 4feeb00..a1de9ec 100644 --- a/src/Pluf/templates/pluf/ab/base.html +++ b/src/Pluf/templates/pluf/ab/base.html @@ -133,10 +133,41 @@ p.note { margin-top: 5px; } +.arrowl { + font-size: 0px; line-height: 0%; width: 0px; + border-top: 10px solid #fff; + border-right: 20px solid #d3d7cf; + border-bottom: 10px solid #fff; + margin-left: -27px; + position: relative; + top: -35px; +} + +.stepstats { + background-color: #d3d7cf; + position: relative; + float: left; + margin-left: 20px; + padding: 0 7px; +} + +.propsstats { + background-color: #d3d7cf; + padding: 1px 15px; + width: 50%; +} + + .clear{clear:both;display:block;overflow:hidden;visibility:hidden;width:0;height:0} -td { +table.funnel td { vertical-align: bottom; + border: none; + padding-right: 30px; + margin: 0; +} +table.funnel, table.funnel tr { + margin: 0; padding: 0; } {/literal} diff --git a/src/Pluf/templates/pluf/ab/funnel.html b/src/Pluf/templates/pluf/ab/funnel.html index 378f8aa..74d48a0 100644 --- a/src/Pluf/templates/pluf/ab/funnel.html +++ b/src/Pluf/templates/pluf/ab/funnel.html @@ -5,9 +5,9 @@

Funnel {$funnel} - {$nperiod}

- +
- @@ -67,6 +71,13 @@

{$stats[$i]['total']} out of {$stats['1']['total']} visitors reached step {$i} of this funnel. This is a completion rate of {$stats[$i]['conv1']}.

+
{assign $stepprops = $stats[$i]['sprops1']} +

Visitor Property {$prop}

+{foreach $stepprops as $k=>$t} +

{$k}: {assign $nn = $t[1]} +{$t[0]} out of {blocktrans $nn}{$nn} visitor{plural}{$nn} visitors{/blocktrans}{if $t[2]} ({$t[2]}){/if} +{/foreach}

+

Note that if a user skip a given step, this can make the results a bit off. @@ -74,9 +85,6 @@ off. {else}

We do not have statistics for this period.

{/if} -{*
-{$stats|dump}
-
*} {/block} {block details} {*
+

Today | @@ -39,10 +39,14 @@ {/if} {elseif isset($step['props'])}{assign $stepprops = $step['sprops']} +

+ {foreach $stepprops as $k=>$t} -

{$k}
-{$t[0]} out of {$t[1]} visitors{if $t[2]}({$t[2]}){/if}

-{/foreach} +

{$k}
{assign $nn = $t[1]} +{$t[0]} out of {blocktrans $nn}{$nn} visitor{plural}{$nn} visitors{/blocktrans}{if $t[2]} ({$t[2]}){/if} +{/foreach}

+ +
{/if}