PluginProbe ʕ •ᴥ•ʔ
Independent Analytics – WordPress Analytics Plugin / 2.14.8
Independent Analytics – WordPress Analytics Plugin v2.14.8
2.15.0 2.14.10 trunk 1.1 1.10 1.10.1 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.17.1 1.17.2 1.17.3 1.17.4 1.18 1.18.1 1.19.0 1.19.1 1.2 1.20.0 1.21.0 1.22.0 1.22.1 1.23.0 1.23.1 1.24.0 1.24.1 1.25.0 1.25.1 1.26.0 1.27.0 1.28.0 1.28.1 1.28.2 1.28.3 1.29.0 1.3 1.30.0 1.30.1 1.4 1.5 1.6 1.7 1.8 1.9 2.0.0 2.0.1 2.1.4 2.1.5 2.1.6 2.10.0 2.10.1 2.10.2 2.10.3 2.10.4 2.11.0 2.11.1 2.11.10 2.11.2 2.11.3 2.11.4 2.11.5 2.11.6 2.11.7 2.11.8 2.11.9 2.12.0 2.12.1 2.12.2 2.13.1 2.13.2 2.13.5 2.13.6 2.14.0 2.14.1 2.14.2 2.14.4 2.14.6 2.14.7 2.14.8 2.14.9 2.2.0 2.2.1 2.3.1 2.3.2 2.4.2 2.4.3 2.5.0 2.5.1 2.6.0 2.6.1 2.6.2 2.6.3 2.6.4 2.7.0 2.7.1 2.7.2 2.7.3 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.8 2.8.9 2.9.2 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7
independent-analytics / IAWP / Models / Universal_Model_Columns.php
independent-analytics / IAWP / Models Last commit date
Campaign.php 10 months ago Campaign_Landing_Page.php 9 months ago Campaign_UTM_Campaign.php 9 months ago Campaign_UTM_Medium.php 9 months ago Campaign_UTM_Source.php 9 months ago ClickWhale_Link_Page.php 1 year ago Current_Traffic.php 2 years ago Device.php 10 months ago Form.php 1 year ago Geo.php 10 months ago Journey.php 5 months ago Link.php 8 months ago Link_Pattern.php 10 months ago Model.php 6 months ago Page.php 10 months ago Page_Author_Archive.php 2 years ago Page_Date_Archive.php 2 years ago Page_Home.php 2 years ago Page_Not_Found.php 1 year ago Page_Post_Type_Archive.php 1 year ago Page_Search.php 2 years ago Page_Singular.php 1 year ago Page_Term_Archive.php 2 years ago Page_Virtual.php 1 year ago Referrer.php 6 months ago Referrer_Type.php 9 months ago Universal_Model_Columns.php 1 year ago Visitor.php 9 months ago
Universal_Model_Columns.php
163 lines
1 <?php
2
3 namespace IAWP\Models;
4
5 use IAWPSCOPED\Illuminate\Support\Str;
6 /** @internal */
7 trait Universal_Model_Columns
8 {
9 /**
10 * Handle dynamic column names such as those for form tracking
11 */
12 public function __call($name, $arguments)
13 {
14 if (Str::startsWith($name, 'form_submissions_for_')) {
15 return $this->as_int($name);
16 } elseif (Str::startsWith($name, 'form_conversion_rate_for_')) {
17 return $this->as_float($name);
18 }
19 }
20 public function form_submissions() : int
21 {
22 return $this->as_int('form_submissions');
23 }
24 public function form_conversion_rate() : float
25 {
26 return $this->as_float('form_conversion_rate');
27 }
28 public function wc_orders() : float
29 {
30 return $this->as_float('wc_orders');
31 }
32 public function wc_gross_sales() : float
33 {
34 return $this->as_float('wc_gross_sales');
35 }
36 public function wc_refunds() : float
37 {
38 return $this->as_float('wc_refunds');
39 }
40 public function wc_refunded_amount() : float
41 {
42 return $this->as_float('wc_refunded_amount');
43 }
44 public function wc_net_sales() : float
45 {
46 return $this->as_float('wc_net_sales');
47 }
48 public function wc_conversion_rate() : float
49 {
50 return $this->as_float('wc_conversion_rate');
51 }
52 public function wc_earnings_per_visitor() : float
53 {
54 return $this->as_float('wc_earnings_per_visitor');
55 }
56 public function wc_average_order_volume() : float
57 {
58 return $this->as_float('wc_average_order_volume');
59 }
60 public function views() : int
61 {
62 return $this->as_int('views');
63 }
64 public function previous_period_views() : int
65 {
66 return $this->as_int('previous_period_views');
67 }
68 public function views_growth() : float
69 {
70 return $this->as_float('views_growth');
71 }
72 public function views_per_session() : float
73 {
74 return $this->as_float('views_per_session');
75 }
76 public function visitors() : int
77 {
78 return $this->as_int('visitors');
79 }
80 public function previous_period_visitors() : int
81 {
82 return $this->as_int('previous_period_views');
83 }
84 public function visitors_growth() : float
85 {
86 return $this->as_float('visitors_growth');
87 }
88 public function clicks() : float
89 {
90 return $this->as_int('clicks');
91 }
92 public function average_session_duration() : ?int
93 {
94 return $this->as_int('average_session_duration', null);
95 }
96 public function average_session_duration_growth() : float
97 {
98 $current = $this->average_session_duration();
99 $previous = $this->previous_period_average_session_duration();
100 if ($current == 0 || $previous == 0) {
101 return 0;
102 } else {
103 return ($current - $previous) / $previous * 100;
104 }
105 }
106 public function average_view_duration() : ?int
107 {
108 return $this->as_int('average_view_duration', null);
109 }
110 public function average_view_duration_growth() : float
111 {
112 $current = $this->average_view_duration();
113 $previous = $this->previous_period_average_view_duration();
114 if ($current == 0 || $previous == 0) {
115 return 0;
116 } else {
117 return ($current - $previous) / $previous * 100;
118 }
119 }
120 public function sessions() : int
121 {
122 return $this->as_int('sessions');
123 }
124 public function previous_period_sessions() : int
125 {
126 return $this->as_int('previous_period_sessions');
127 }
128 public function sessions_growth() : float
129 {
130 $current = $this->sessions();
131 $previous = $this->previous_period_sessions();
132 if ($current == 0 || $previous == 0) {
133 return 0;
134 } else {
135 return ($current - $previous) / $previous * 100;
136 }
137 }
138 public function previous_period_average_session_duration() : int
139 {
140 return $this->as_int('previous_period_average_session_duration');
141 }
142 public function previous_period_average_view_duration() : int
143 {
144 return $this->as_int('previous_period_average_view_duration');
145 }
146 public function bounces() : int
147 {
148 return $this->as_int('bounces');
149 }
150 public function bounce_rate() : float
151 {
152 return $this->as_float('bounce_rate');
153 }
154 private function as_float($property, $default = 0) : ?float
155 {
156 return \property_exists($this->row, $property) && $this->row->{$property} !== null ? \floatval($this->row->{$property}) : $default;
157 }
158 private function as_int($property, $default = 0) : ?int
159 {
160 return \property_exists($this->row, $property) && $this->row->{$property} !== null ? \intval($this->row->{$property}) : $default;
161 }
162 }
163