Version Description
- Ensured page title and location are properly being sent to Google
Download this release
Release Info
| Developer | nmarks |
| Plugin | |
| Version | 1.5.3 |
| Comparing to | |
| See all releases | |
Code changes from version 1.5.2 to 1.5.3
- README.txt +4 -1
- gravity-forms-event-tracking.php +1 -1
- includes/class-gravity-forms-event-tracking.php +25 -18
- includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/AbstractTracking.php +655 -1
- includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/App/Event.php +2 -85
- includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/App/Screen.php +1 -73
- includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Ecommerce/Item.php +13 -18
- includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Ecommerce/Transaction.php +10 -25
- includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Event.php +1 -1
- includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Exception.php +1 -1
- includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Page.php +1 -80
- includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Social.php +1 -1
- includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/User/Timing.php +1 -1
README.txt
CHANGED
|
@@ -3,7 +3,7 @@ Contributors: nmarks
|
|
| 3 |
Tags: gravity forms, google analytics, event tracking
|
| 4 |
Requires at least: 3.5.2
|
| 5 |
Tested up to: 4.1
|
| 6 |
-
Stable tag: 1.5.
|
| 7 |
License: GPLv2 or later
|
| 8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 9 |
|
|
@@ -80,6 +80,9 @@ Check out the documentation on [github](https://github.com/nathanmarks/wordpress
|
|
| 80 |
|
| 81 |
== Changelog ==
|
| 82 |
|
|
|
|
|
|
|
|
|
|
| 83 |
= 1.5.2 =
|
| 84 |
* Hotfix for PHP strict standards warning
|
| 85 |
|
| 3 |
Tags: gravity forms, google analytics, event tracking
|
| 4 |
Requires at least: 3.5.2
|
| 5 |
Tested up to: 4.1
|
| 6 |
+
Stable tag: 1.5.3
|
| 7 |
License: GPLv2 or later
|
| 8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 9 |
|
| 80 |
|
| 81 |
== Changelog ==
|
| 82 |
|
| 83 |
+
= 1.5.3 =
|
| 84 |
+
* Ensured page title and location are properly being sent to Google
|
| 85 |
+
|
| 86 |
= 1.5.2 =
|
| 87 |
* Hotfix for PHP strict standards warning
|
| 88 |
|
gravity-forms-event-tracking.php
CHANGED
|
@@ -10,7 +10,7 @@
|
|
| 10 |
* Plugin Name: Gravity Forms Google Analytics Event Tracking
|
| 11 |
* Plugin URI: https://wordpress.org/plugins/gravity-forms-google-analytics-event-tracking/
|
| 12 |
* Description: Add Google Analytics event tracking to your Gravity Forms with ease.
|
| 13 |
-
* Version: 1.5.
|
| 14 |
* Author: Nathan Marks
|
| 15 |
* Author URI: http://www.nvisionsolutions.ca
|
| 16 |
* Text Domain: gravity-forms-google-analytics-event-tracking
|
| 10 |
* Plugin Name: Gravity Forms Google Analytics Event Tracking
|
| 11 |
* Plugin URI: https://wordpress.org/plugins/gravity-forms-google-analytics-event-tracking/
|
| 12 |
* Description: Add Google Analytics event tracking to your Gravity Forms with ease.
|
| 13 |
+
* Version: 1.5.3
|
| 14 |
* Author: Nathan Marks
|
| 15 |
* Author URI: http://www.nvisionsolutions.ca
|
| 16 |
* Text Domain: gravity-forms-google-analytics-event-tracking
|
includes/class-gravity-forms-event-tracking.php
CHANGED
|
@@ -13,7 +13,7 @@
|
|
| 13 |
GFForms::include_addon_framework();
|
| 14 |
|
| 15 |
class Gravity_Forms_Event_Tracking extends GFAddOn {
|
| 16 |
-
protected $_version = "1.5.
|
| 17 |
protected $_min_gravityforms_version = "1.8.20";
|
| 18 |
|
| 19 |
/**
|
|
@@ -144,21 +144,22 @@ class Gravity_Forms_Event_Tracking extends GFAddOn {
|
|
| 144 |
* @param array $form Gravity Forms form object
|
| 145 |
*/
|
| 146 |
public function track_form_after_submission( $entry, $form ) {
|
| 147 |
-
|
| 148 |
// Temporary until Gravity fix a bug
|
| 149 |
-
$entry = GFAPI::get_entry( $entry['id'] );
|
| 150 |
|
| 151 |
-
//
|
| 152 |
-
|
| 153 |
-
|
|
|
|
| 154 |
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
|
| 163 |
// Push the event to google
|
| 164 |
$this->push_event( $entry, $form );
|
|
@@ -177,10 +178,6 @@ class Gravity_Forms_Event_Tracking extends GFAddOn {
|
|
| 177 |
return;
|
| 178 |
}
|
| 179 |
|
| 180 |
-
// Fetch the cookie we saved previously and set it into the cookie global
|
| 181 |
-
// The php analytics library looks for this
|
| 182 |
-
$_COOKIE['_ga'] = gform_get_meta( $entry['id'], 'ga_cookie' );
|
| 183 |
-
|
| 184 |
$form = GFFormsModel::get_form_meta( $entry['form_id'] );
|
| 185 |
|
| 186 |
// Push the event to google
|
|
@@ -200,8 +197,18 @@ class Gravity_Forms_Event_Tracking extends GFAddOn {
|
|
| 200 |
}
|
| 201 |
|
| 202 |
// Init tracking object
|
| 203 |
-
$this->tracking = new \Racecore\GATracking\GATracking( apply_filters( 'gform_ua_id', $this->ua_id, $form ),
|
| 204 |
$event = new \Racecore\GATracking\Tracking\Event();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 205 |
|
| 206 |
// Get event defaults
|
| 207 |
$event_category = 'Forms';
|
| 13 |
GFForms::include_addon_framework();
|
| 14 |
|
| 15 |
class Gravity_Forms_Event_Tracking extends GFAddOn {
|
| 16 |
+
protected $_version = "1.5.3";
|
| 17 |
protected $_min_gravityforms_version = "1.8.20";
|
| 18 |
|
| 19 |
/**
|
| 144 |
* @param array $form Gravity Forms form object
|
| 145 |
*/
|
| 146 |
public function track_form_after_submission( $entry, $form ) {
|
| 147 |
+
global $post;
|
| 148 |
// Temporary until Gravity fix a bug
|
| 149 |
+
// $entry = GFAPI::get_entry( $entry['id'] );
|
| 150 |
|
| 151 |
+
// Set some vars to send to GA
|
| 152 |
+
$ga_cookie = $_COOKIE['_ga'];
|
| 153 |
+
$document_location = 'http' . ( isset( $_SERVER['HTTPS'] ) ? 's' : '' ) . '://' . $_SERVER['HTTP_HOST'] . '/' . $_SERVER['REQUEST_URI'];
|
| 154 |
+
$document_title = get_the_title( $post );
|
| 155 |
|
| 156 |
+
$ga_event_vars = array(
|
| 157 |
+
'ga_cookie' => $_COOKIE['_ga'],
|
| 158 |
+
'document_location' => $document_location,
|
| 159 |
+
'document_title' => $document_title
|
| 160 |
+
);
|
| 161 |
+
|
| 162 |
+
gform_update_meta( $entry['id'], 'ga_event_vars', maybe_serialize( $ga_event_vars ) );
|
| 163 |
|
| 164 |
// Push the event to google
|
| 165 |
$this->push_event( $entry, $form );
|
| 178 |
return;
|
| 179 |
}
|
| 180 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 181 |
$form = GFFormsModel::get_form_meta( $entry['form_id'] );
|
| 182 |
|
| 183 |
// Push the event to google
|
| 197 |
}
|
| 198 |
|
| 199 |
// Init tracking object
|
| 200 |
+
$this->tracking = new \Racecore\GATracking\GATracking( apply_filters( 'gform_ua_id', $this->ua_id, $form ), true );
|
| 201 |
$event = new \Racecore\GATracking\Tracking\Event();
|
| 202 |
+
|
| 203 |
+
// get some stored vars
|
| 204 |
+
$ga_event_vars = maybe_unserialize( gform_get_meta( $entry['id'], 'ga_event_vars' ) );
|
| 205 |
+
|
| 206 |
+
// Set some defaults
|
| 207 |
+
$event->setDocumentLocation( $ga_event_vars['document_location'] );
|
| 208 |
+
$event->setDocumentTitle( $ga_event_vars['document_title'] );
|
| 209 |
+
|
| 210 |
+
// Override this in case coming from paypal IPN
|
| 211 |
+
$_COOKIE['_ga'] = $ga_event_vars['ga_cookie'];
|
| 212 |
|
| 213 |
// Get event defaults
|
| 214 |
$event_category = 'Forms';
|
includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/AbstractTracking.php
CHANGED
|
@@ -19,13 +19,667 @@ namespace Racecore\GATracking\Tracking;
|
|
| 19 |
*/
|
| 20 |
abstract class AbstractTracking
|
| 21 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
/**
|
| 24 |
* Get the transfer Paket from current Event
|
| 25 |
*
|
| 26 |
* @return array
|
| 27 |
*/
|
| 28 |
-
abstract public function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
}
|
| 19 |
*/
|
| 20 |
abstract class AbstractTracking
|
| 21 |
{
|
| 22 |
+
// document referrer
|
| 23 |
+
/** @var String */
|
| 24 |
+
private $documentReferrer;
|
| 25 |
+
|
| 26 |
+
// campaign
|
| 27 |
+
/** @var String */
|
| 28 |
+
private $campaignName, $campaignSource, $campaignMedium, $campaignContent, $campaignID, $campaignKeyword;
|
| 29 |
+
|
| 30 |
+
// adwords id
|
| 31 |
+
/** @var String */
|
| 32 |
+
private $adwordsID;
|
| 33 |
+
|
| 34 |
+
// display ads id
|
| 35 |
+
/** @var String */
|
| 36 |
+
private $displayAdsID;
|
| 37 |
+
|
| 38 |
+
// screen resolution
|
| 39 |
+
/** @var String */
|
| 40 |
+
private $screenResolution;
|
| 41 |
+
|
| 42 |
+
// viewport size
|
| 43 |
+
/** @var String */
|
| 44 |
+
private $viewportSize;
|
| 45 |
+
|
| 46 |
+
// document encoding
|
| 47 |
+
/** @var String */
|
| 48 |
+
private $documentEncoding;
|
| 49 |
+
|
| 50 |
+
// screen colors
|
| 51 |
+
/** @var String */
|
| 52 |
+
private $screenColors;
|
| 53 |
+
|
| 54 |
+
// user language
|
| 55 |
+
/** @var String */
|
| 56 |
+
private $userLanguage;
|
| 57 |
+
|
| 58 |
+
// java enabled
|
| 59 |
+
/** @var boolean|string */
|
| 60 |
+
private $javaEnabled = null;
|
| 61 |
+
|
| 62 |
+
// flash version
|
| 63 |
+
/** @var String */
|
| 64 |
+
private $flashVersion;
|
| 65 |
+
|
| 66 |
+
// document location
|
| 67 |
+
/** @var String */
|
| 68 |
+
private $documentLocation;
|
| 69 |
+
|
| 70 |
+
// document host
|
| 71 |
+
/** @var String */
|
| 72 |
+
private $documentHost;
|
| 73 |
+
|
| 74 |
+
// document path
|
| 75 |
+
/** @var String */
|
| 76 |
+
private $documentPath;
|
| 77 |
+
|
| 78 |
+
// document title
|
| 79 |
+
/** @var String */
|
| 80 |
+
private $documentTitle;
|
| 81 |
+
|
| 82 |
+
// app name
|
| 83 |
+
/** @var String */
|
| 84 |
+
private $appName;
|
| 85 |
+
|
| 86 |
+
// app version
|
| 87 |
+
/** @var String */
|
| 88 |
+
private $appVersion;
|
| 89 |
+
|
| 90 |
+
// experiment id
|
| 91 |
+
/** @var String */
|
| 92 |
+
private $experimentID;
|
| 93 |
+
|
| 94 |
+
// experiment variant
|
| 95 |
+
/** @var String */
|
| 96 |
+
private $experimentVariant;
|
| 97 |
+
|
| 98 |
+
// content description
|
| 99 |
+
/** @var String */
|
| 100 |
+
private $contentDescription;
|
| 101 |
+
|
| 102 |
+
// link id
|
| 103 |
+
/** @var String */
|
| 104 |
+
private $linkID;
|
| 105 |
+
|
| 106 |
+
// custom dimensions
|
| 107 |
+
/** @var Array */
|
| 108 |
+
private $customDimension = array();
|
| 109 |
+
|
| 110 |
+
// custom metric
|
| 111 |
+
/** @var Array */
|
| 112 |
+
private $customMetric = array();
|
| 113 |
+
|
| 114 |
+
// productId
|
| 115 |
+
/** @var string */
|
| 116 |
+
private $productId;
|
| 117 |
|
| 118 |
/**
|
| 119 |
* Get the transfer Paket from current Event
|
| 120 |
*
|
| 121 |
* @return array
|
| 122 |
*/
|
| 123 |
+
abstract public function createPackage();
|
| 124 |
+
|
| 125 |
+
/**
|
| 126 |
+
* Returns the Paket for Event Tracking
|
| 127 |
+
*
|
| 128 |
+
* @return array
|
| 129 |
+
* @throws \Racecore\GATracking\Exception\MissingTrackingParameterException
|
| 130 |
+
* @deprecated
|
| 131 |
+
*/
|
| 132 |
+
public function getPaket()
|
| 133 |
+
{
|
| 134 |
+
return $this->createPackage();
|
| 135 |
+
}
|
| 136 |
|
| 137 |
+
/**
|
| 138 |
+
* @return array
|
| 139 |
+
*/
|
| 140 |
+
public function getPackage()
|
| 141 |
+
{
|
| 142 |
+
$package = array_merge($this->createPackage(), array(
|
| 143 |
+
// campaign
|
| 144 |
+
'cn' => $this->getCampaignName(),
|
| 145 |
+
'cs' => $this->getCampaignSource(),
|
| 146 |
+
'cm' => $this->getCampaignMedium(),
|
| 147 |
+
'ck' => $this->getCampaignKeyword(),
|
| 148 |
+
'cc' => $this->getCampaignContent(),
|
| 149 |
+
'ci' => $this->getCampaignID(),
|
| 150 |
+
|
| 151 |
+
// other
|
| 152 |
+
'dr' => $this->getDocumentReferrer(),
|
| 153 |
+
'gclid' => $this->getAdwordsID(),
|
| 154 |
+
'dclid' => $this->getDisplayAdsID(),
|
| 155 |
+
|
| 156 |
+
// system info
|
| 157 |
+
'sr' => $this->getScreenResolution(),
|
| 158 |
+
'sd' => $this->getScreenColors(),
|
| 159 |
+
'vp' => $this->getViewportSize(),
|
| 160 |
+
'de' => $this->getDocumentEncoding(),
|
| 161 |
+
'ul' => $this->getUserLanguage(),
|
| 162 |
+
'je' => $this->getJavaEnabled(),
|
| 163 |
+
'fl' => $this->getFlashVersion(),
|
| 164 |
+
|
| 165 |
+
// Content Information
|
| 166 |
+
'dl' => $this->getDocumentLocation(),
|
| 167 |
+
'dh' => $this->getDocumentHost(),
|
| 168 |
+
'dp' => $this->getDocumentPath(),
|
| 169 |
+
'dt' => $this->getDocumentTitle(),
|
| 170 |
+
'cd' => $this->getContentDescription(),
|
| 171 |
+
'linkid' => $this->getLinkID(),
|
| 172 |
+
|
| 173 |
+
// app tracking
|
| 174 |
+
'an' => $this->getAppName(),
|
| 175 |
+
'av' => $this->getAppVersion(),
|
| 176 |
+
|
| 177 |
+
// enhanced e-commerce
|
| 178 |
+
|
| 179 |
+
|
| 180 |
+
|
| 181 |
+
// content experiments
|
| 182 |
+
'xid' => $this->getExperimentID(),
|
| 183 |
+
'xvar' => $this->getExperimentVariant(),
|
| 184 |
+
));
|
| 185 |
+
|
| 186 |
+
$package = $this->addCustomParameters($package);
|
| 187 |
+
|
| 188 |
+
// remove all unused
|
| 189 |
+
$package = array_filter($package, 'strlen');
|
| 190 |
+
|
| 191 |
+
return $package;
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
/**
|
| 195 |
+
* @param array $package
|
| 196 |
+
* @return array
|
| 197 |
+
*/
|
| 198 |
+
private function addCustomParameters( Array $package )
|
| 199 |
+
{
|
| 200 |
+
// add custom metric params
|
| 201 |
+
foreach( $this->customMetric as $id => $value )
|
| 202 |
+
{
|
| 203 |
+
$package['cm' . (int) $id ] = $value;
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
// add custom dimension params
|
| 207 |
+
foreach( $this->customDimension as $id => $value )
|
| 208 |
+
{
|
| 209 |
+
$package['cd' . (int) $id ] = $value;
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
return $package;
|
| 213 |
+
}
|
| 214 |
+
|
| 215 |
+
/**
|
| 216 |
+
* @param null $id
|
| 217 |
+
* @param $value
|
| 218 |
+
*/
|
| 219 |
+
public function setCustomDimension($id = null, $value)
|
| 220 |
+
{
|
| 221 |
+
$this->customDimension[$id] = $value;
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
+
/**
|
| 225 |
+
* @param null $id
|
| 226 |
+
* @param $value
|
| 227 |
+
*/
|
| 228 |
+
public function setCustomMetric($id = null, $value)
|
| 229 |
+
{
|
| 230 |
+
$this->customMetric[$id] = $value;
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
/**
|
| 234 |
+
* @param String $contentDescription
|
| 235 |
+
*/
|
| 236 |
+
public function setContentDescription($contentDescription)
|
| 237 |
+
{
|
| 238 |
+
$this->contentDescription = $contentDescription;
|
| 239 |
+
}
|
| 240 |
+
|
| 241 |
+
/**
|
| 242 |
+
* @return String
|
| 243 |
+
*/
|
| 244 |
+
public function getContentDescription()
|
| 245 |
+
{
|
| 246 |
+
return $this->contentDescription;
|
| 247 |
+
}
|
| 248 |
+
|
| 249 |
+
/**
|
| 250 |
+
* @param String $linkID
|
| 251 |
+
*/
|
| 252 |
+
public function setLinkID($linkID)
|
| 253 |
+
{
|
| 254 |
+
$this->linkID = $linkID;
|
| 255 |
+
}
|
| 256 |
+
|
| 257 |
+
/**
|
| 258 |
+
* @return String
|
| 259 |
+
*/
|
| 260 |
+
public function getLinkID()
|
| 261 |
+
{
|
| 262 |
+
return $this->linkID;
|
| 263 |
+
}
|
| 264 |
+
|
| 265 |
+
/**
|
| 266 |
+
* @param String $adwordsID
|
| 267 |
+
*/
|
| 268 |
+
public function setAdwordsID($adwordsID)
|
| 269 |
+
{
|
| 270 |
+
$this->adwordsID = $adwordsID;
|
| 271 |
+
}
|
| 272 |
+
|
| 273 |
+
/**
|
| 274 |
+
* @return String
|
| 275 |
+
*/
|
| 276 |
+
public function getAdwordsID()
|
| 277 |
+
{
|
| 278 |
+
return $this->adwordsID;
|
| 279 |
+
}
|
| 280 |
+
|
| 281 |
+
/**
|
| 282 |
+
* @param String $appName
|
| 283 |
+
*/
|
| 284 |
+
public function setAppName($appName)
|
| 285 |
+
{
|
| 286 |
+
$this->appName = $appName;
|
| 287 |
+
}
|
| 288 |
+
|
| 289 |
+
/**
|
| 290 |
+
* @return String
|
| 291 |
+
*/
|
| 292 |
+
public function getAppName()
|
| 293 |
+
{
|
| 294 |
+
return $this->appName;
|
| 295 |
+
}
|
| 296 |
+
|
| 297 |
+
/**
|
| 298 |
+
* @param String $appVersion
|
| 299 |
+
*/
|
| 300 |
+
public function setAppVersion($appVersion)
|
| 301 |
+
{
|
| 302 |
+
$this->appVersion = $appVersion;
|
| 303 |
+
}
|
| 304 |
+
|
| 305 |
+
/**
|
| 306 |
+
* @return String
|
| 307 |
+
*/
|
| 308 |
+
public function getAppVersion()
|
| 309 |
+
{
|
| 310 |
+
return $this->appVersion;
|
| 311 |
+
}
|
| 312 |
+
|
| 313 |
+
/**
|
| 314 |
+
* @param String $campaignContent
|
| 315 |
+
*/
|
| 316 |
+
public function setCampaignContent($campaignContent)
|
| 317 |
+
{
|
| 318 |
+
$this->campaignContent = $campaignContent;
|
| 319 |
+
}
|
| 320 |
+
|
| 321 |
+
/**
|
| 322 |
+
* @return String
|
| 323 |
+
*/
|
| 324 |
+
public function getCampaignContent()
|
| 325 |
+
{
|
| 326 |
+
return $this->campaignContent;
|
| 327 |
+
}
|
| 328 |
+
|
| 329 |
+
/**
|
| 330 |
+
* @param String $campaignID
|
| 331 |
+
*/
|
| 332 |
+
public function setCampaignID($campaignID)
|
| 333 |
+
{
|
| 334 |
+
$this->campaignID = $campaignID;
|
| 335 |
+
}
|
| 336 |
+
|
| 337 |
+
/**
|
| 338 |
+
* @return String
|
| 339 |
+
*/
|
| 340 |
+
public function getCampaignID()
|
| 341 |
+
{
|
| 342 |
+
return $this->campaignID;
|
| 343 |
+
}
|
| 344 |
+
|
| 345 |
+
/**
|
| 346 |
+
* @param String $campaignKeyword
|
| 347 |
+
*/
|
| 348 |
+
public function setCampaignKeyword($campaignKeyword)
|
| 349 |
+
{
|
| 350 |
+
$this->campaignKeyword = $campaignKeyword;
|
| 351 |
+
}
|
| 352 |
+
|
| 353 |
+
/**
|
| 354 |
+
* @deprecated Use setCampaignKeyword
|
| 355 |
+
* @param $campaignKeyword
|
| 356 |
+
*/
|
| 357 |
+
public function setCampaignKeywords($campaignKeyword)
|
| 358 |
+
{
|
| 359 |
+
if( is_array($campaignKeyword) )
|
| 360 |
+
{
|
| 361 |
+
return $this->setCampaignKeyword(implode(',', $campaignKeyword));
|
| 362 |
+
}
|
| 363 |
+
|
| 364 |
+
$this->setCampaignKeyword($campaignKeyword);
|
| 365 |
+
}
|
| 366 |
+
|
| 367 |
+
/**
|
| 368 |
+
* @return Array
|
| 369 |
+
*/
|
| 370 |
+
public function getCampaignKeyword()
|
| 371 |
+
{
|
| 372 |
+
return $this->campaignKeyword;
|
| 373 |
+
}
|
| 374 |
+
|
| 375 |
+
/**
|
| 376 |
+
* @param String $campaignMedium
|
| 377 |
+
*/
|
| 378 |
+
public function setCampaignMedium($campaignMedium)
|
| 379 |
+
{
|
| 380 |
+
$this->campaignMedium = $campaignMedium;
|
| 381 |
+
}
|
| 382 |
+
|
| 383 |
+
/**
|
| 384 |
+
* @return String
|
| 385 |
+
*/
|
| 386 |
+
public function getCampaignMedium()
|
| 387 |
+
{
|
| 388 |
+
return $this->campaignMedium;
|
| 389 |
+
}
|
| 390 |
+
|
| 391 |
+
/**
|
| 392 |
+
* @param String $campaignName
|
| 393 |
+
*/
|
| 394 |
+
public function setCampaignName($campaignName)
|
| 395 |
+
{
|
| 396 |
+
$this->campaignName = $campaignName;
|
| 397 |
+
}
|
| 398 |
+
|
| 399 |
+
/**
|
| 400 |
+
* @return String
|
| 401 |
+
*/
|
| 402 |
+
public function getCampaignName()
|
| 403 |
+
{
|
| 404 |
+
return $this->campaignName;
|
| 405 |
+
}
|
| 406 |
+
|
| 407 |
+
/**
|
| 408 |
+
* @param String $campaignSource
|
| 409 |
+
*/
|
| 410 |
+
public function setCampaignSource($campaignSource)
|
| 411 |
+
{
|
| 412 |
+
$this->campaignSource = $campaignSource;
|
| 413 |
+
}
|
| 414 |
+
|
| 415 |
+
/**
|
| 416 |
+
* @return String
|
| 417 |
+
*/
|
| 418 |
+
public function getCampaignSource()
|
| 419 |
+
{
|
| 420 |
+
return $this->campaignSource;
|
| 421 |
+
}
|
| 422 |
+
|
| 423 |
+
/**
|
| 424 |
+
* @param String $displayAdsID
|
| 425 |
+
*/
|
| 426 |
+
public function setDisplayAdsID($displayAdsID)
|
| 427 |
+
{
|
| 428 |
+
$this->displayAdsID = $displayAdsID;
|
| 429 |
+
}
|
| 430 |
+
|
| 431 |
+
/**
|
| 432 |
+
* @return String
|
| 433 |
+
*/
|
| 434 |
+
public function getDisplayAdsID()
|
| 435 |
+
{
|
| 436 |
+
return $this->displayAdsID;
|
| 437 |
+
}
|
| 438 |
+
|
| 439 |
+
/**
|
| 440 |
+
* @param String $documentEncoding
|
| 441 |
+
*/
|
| 442 |
+
public function setDocumentEncoding($documentEncoding)
|
| 443 |
+
{
|
| 444 |
+
$this->documentEncoding = $documentEncoding;
|
| 445 |
+
}
|
| 446 |
+
|
| 447 |
+
/**
|
| 448 |
+
* @return String
|
| 449 |
+
*/
|
| 450 |
+
public function getDocumentEncoding()
|
| 451 |
+
{
|
| 452 |
+
return $this->documentEncoding;
|
| 453 |
+
}
|
| 454 |
+
|
| 455 |
+
/**
|
| 456 |
+
* @param String $documentHost
|
| 457 |
+
*/
|
| 458 |
+
public function setDocumentHost($documentHost)
|
| 459 |
+
{
|
| 460 |
+
$this->documentHost = $documentHost;
|
| 461 |
+
}
|
| 462 |
+
|
| 463 |
+
/**
|
| 464 |
+
* @return String
|
| 465 |
+
*/
|
| 466 |
+
public function getDocumentHost()
|
| 467 |
+
{
|
| 468 |
+
return $this->documentHost;
|
| 469 |
+
}
|
| 470 |
+
|
| 471 |
+
/**
|
| 472 |
+
* @param String $documentLocation
|
| 473 |
+
*/
|
| 474 |
+
public function setDocumentLocation($documentLocation)
|
| 475 |
+
{
|
| 476 |
+
$this->documentLocation = $documentLocation;
|
| 477 |
+
}
|
| 478 |
+
|
| 479 |
+
/**
|
| 480 |
+
* @return String
|
| 481 |
+
*/
|
| 482 |
+
public function getDocumentLocation()
|
| 483 |
+
{
|
| 484 |
+
return $this->documentLocation;
|
| 485 |
+
}
|
| 486 |
+
|
| 487 |
+
/**
|
| 488 |
+
* @param String $documentPath
|
| 489 |
+
*/
|
| 490 |
+
public function setDocumentPath($documentPath)
|
| 491 |
+
{
|
| 492 |
+
$this->documentPath = $documentPath;
|
| 493 |
+
}
|
| 494 |
+
|
| 495 |
+
/**
|
| 496 |
+
* @return String
|
| 497 |
+
*/
|
| 498 |
+
public function getDocumentPath()
|
| 499 |
+
{
|
| 500 |
+
return $this->documentPath;
|
| 501 |
+
}
|
| 502 |
+
|
| 503 |
+
/**
|
| 504 |
+
* @param String $documentReferrer
|
| 505 |
+
*/
|
| 506 |
+
public function setDocumentReferrer($documentReferrer)
|
| 507 |
+
{
|
| 508 |
+
$this->documentReferrer = $documentReferrer;
|
| 509 |
+
}
|
| 510 |
+
|
| 511 |
+
/**
|
| 512 |
+
* @return String
|
| 513 |
+
*/
|
| 514 |
+
public function getDocumentReferrer()
|
| 515 |
+
{
|
| 516 |
+
return $this->documentReferrer;
|
| 517 |
+
}
|
| 518 |
+
|
| 519 |
+
/**
|
| 520 |
+
* @param String $documentTitle
|
| 521 |
+
*/
|
| 522 |
+
public function setDocumentTitle($documentTitle)
|
| 523 |
+
{
|
| 524 |
+
$this->documentTitle = $documentTitle;
|
| 525 |
+
}
|
| 526 |
+
|
| 527 |
+
/**
|
| 528 |
+
* @return String
|
| 529 |
+
*/
|
| 530 |
+
public function getDocumentTitle()
|
| 531 |
+
{
|
| 532 |
+
return $this->documentTitle;
|
| 533 |
+
}
|
| 534 |
+
|
| 535 |
+
/**
|
| 536 |
+
* @param String $experimentID
|
| 537 |
+
*/
|
| 538 |
+
public function setExperimentID($experimentID)
|
| 539 |
+
{
|
| 540 |
+
$this->experimentID = $experimentID;
|
| 541 |
+
}
|
| 542 |
+
|
| 543 |
+
/**
|
| 544 |
+
* @return String
|
| 545 |
+
*/
|
| 546 |
+
public function getExperimentID()
|
| 547 |
+
{
|
| 548 |
+
return $this->experimentID;
|
| 549 |
+
}
|
| 550 |
+
|
| 551 |
+
/**
|
| 552 |
+
* @param String $experimentVariant
|
| 553 |
+
*/
|
| 554 |
+
public function setExperimentVariant($experimentVariant)
|
| 555 |
+
{
|
| 556 |
+
$this->experimentVariant = $experimentVariant;
|
| 557 |
+
}
|
| 558 |
+
|
| 559 |
+
/**
|
| 560 |
+
* @return String
|
| 561 |
+
*/
|
| 562 |
+
public function getExperimentVariant()
|
| 563 |
+
{
|
| 564 |
+
return $this->experimentVariant;
|
| 565 |
+
}
|
| 566 |
+
|
| 567 |
+
/**
|
| 568 |
+
* @param String $flashVersion
|
| 569 |
+
*/
|
| 570 |
+
public function setFlashVersion($flashVersion)
|
| 571 |
+
{
|
| 572 |
+
$this->flashVersion = $flashVersion;
|
| 573 |
+
}
|
| 574 |
+
|
| 575 |
+
/**
|
| 576 |
+
* @return String
|
| 577 |
+
*/
|
| 578 |
+
public function getFlashVersion()
|
| 579 |
+
{
|
| 580 |
+
return $this->flashVersion;
|
| 581 |
+
}
|
| 582 |
+
|
| 583 |
+
/**
|
| 584 |
+
* @param boolean $javaEnabled
|
| 585 |
+
*/
|
| 586 |
+
public function setJavaEnabled($javaEnabled)
|
| 587 |
+
{
|
| 588 |
+
$this->javaEnabled = (bool) $javaEnabled;
|
| 589 |
+
}
|
| 590 |
+
|
| 591 |
+
/**
|
| 592 |
+
* @return boolean
|
| 593 |
+
*/
|
| 594 |
+
public function getJavaEnabled()
|
| 595 |
+
{
|
| 596 |
+
if( $this->javaEnabled === null ){
|
| 597 |
+
return null;
|
| 598 |
+
}
|
| 599 |
+
|
| 600 |
+
return $this->javaEnabled ? '1' : '0';
|
| 601 |
+
}
|
| 602 |
+
|
| 603 |
+
/**
|
| 604 |
+
* @param String $screenColors
|
| 605 |
+
*/
|
| 606 |
+
public function setScreenColors($screenColors)
|
| 607 |
+
{
|
| 608 |
+
$this->screenColors = $screenColors;
|
| 609 |
+
}
|
| 610 |
+
|
| 611 |
+
/**
|
| 612 |
+
* @return String
|
| 613 |
+
*/
|
| 614 |
+
public function getScreenColors()
|
| 615 |
+
{
|
| 616 |
+
return $this->screenColors;
|
| 617 |
+
}
|
| 618 |
+
|
| 619 |
+
/**
|
| 620 |
+
* @param $width
|
| 621 |
+
* @param $height
|
| 622 |
+
*/
|
| 623 |
+
public function setScreenResolution($width, $height)
|
| 624 |
+
{
|
| 625 |
+
$this->screenResolution = $width . 'x' . $height;
|
| 626 |
+
}
|
| 627 |
+
|
| 628 |
+
/**
|
| 629 |
+
* @return String
|
| 630 |
+
*/
|
| 631 |
+
public function getScreenResolution()
|
| 632 |
+
{
|
| 633 |
+
return $this->screenResolution;
|
| 634 |
+
}
|
| 635 |
+
|
| 636 |
+
/**
|
| 637 |
+
* @param String $userLanguage
|
| 638 |
+
*/
|
| 639 |
+
public function setUserLanguage($userLanguage)
|
| 640 |
+
{
|
| 641 |
+
$this->userLanguage = $userLanguage;
|
| 642 |
+
}
|
| 643 |
+
|
| 644 |
+
/**
|
| 645 |
+
* @return String
|
| 646 |
+
*/
|
| 647 |
+
public function getUserLanguage()
|
| 648 |
+
{
|
| 649 |
+
return $this->userLanguage;
|
| 650 |
+
}
|
| 651 |
+
|
| 652 |
+
/**
|
| 653 |
+
* @param $width
|
| 654 |
+
* @param $height
|
| 655 |
+
*/
|
| 656 |
+
public function setViewportSize($width, $height)
|
| 657 |
+
{
|
| 658 |
+
$this->viewportSize = $width . 'x' . $height;
|
| 659 |
+
}
|
| 660 |
+
|
| 661 |
+
/**
|
| 662 |
+
* @return String
|
| 663 |
+
*/
|
| 664 |
+
public function getViewportSize()
|
| 665 |
+
{
|
| 666 |
+
return $this->viewportSize;
|
| 667 |
+
}
|
| 668 |
+
|
| 669 |
+
/**
|
| 670 |
+
* @param string $productId
|
| 671 |
+
*/
|
| 672 |
+
public function setProductId($productId)
|
| 673 |
+
{
|
| 674 |
+
$this->productId = $productId;
|
| 675 |
+
}
|
| 676 |
+
|
| 677 |
+
/**
|
| 678 |
+
* @return string
|
| 679 |
+
*/
|
| 680 |
+
public function getProductId()
|
| 681 |
+
{
|
| 682 |
+
return $this->productId;
|
| 683 |
+
}
|
| 684 |
|
| 685 |
}
|
includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/App/Event.php
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?php
|
| 2 |
namespace Racecore\GATracking\Tracking\App;
|
| 3 |
|
| 4 |
-
use Racecore\GATracking\Tracking\
|
| 5 |
|
| 6 |
/**
|
| 7 |
* Google Analytics Measurement PHP Class
|
|
@@ -19,89 +19,6 @@ use Racecore\GATracking\Tracking\AbstractTracking;
|
|
| 19 |
* @url http://www.racecore.de
|
| 20 |
* @package Racecore\GATracking\Tracking\App
|
| 21 |
*/
|
| 22 |
-
class Event extends
|
| 23 |
{
|
| 24 |
-
/** @var string */
|
| 25 |
-
private $appName;
|
| 26 |
-
|
| 27 |
-
/** @var string */
|
| 28 |
-
private $eventCategory;
|
| 29 |
-
|
| 30 |
-
/** @var string */
|
| 31 |
-
private $eventAction;
|
| 32 |
-
|
| 33 |
-
/**
|
| 34 |
-
* Set the Application Name
|
| 35 |
-
*
|
| 36 |
-
* @param string $appName
|
| 37 |
-
*/
|
| 38 |
-
public function setAppName($appName)
|
| 39 |
-
{
|
| 40 |
-
$this->appName = $appName;
|
| 41 |
-
}
|
| 42 |
-
|
| 43 |
-
/**
|
| 44 |
-
* Get the Application Name
|
| 45 |
-
*
|
| 46 |
-
* @return string
|
| 47 |
-
*/
|
| 48 |
-
public function getAppName()
|
| 49 |
-
{
|
| 50 |
-
return $this->appName;
|
| 51 |
-
}
|
| 52 |
-
|
| 53 |
-
/**
|
| 54 |
-
* Set the Event Action
|
| 55 |
-
*
|
| 56 |
-
* @param string $eventAction
|
| 57 |
-
*/
|
| 58 |
-
public function setEventAction($eventAction)
|
| 59 |
-
{
|
| 60 |
-
$this->eventAction = $eventAction;
|
| 61 |
-
}
|
| 62 |
-
|
| 63 |
-
/**
|
| 64 |
-
* Get the Event Action
|
| 65 |
-
*
|
| 66 |
-
* @return string
|
| 67 |
-
*/
|
| 68 |
-
public function getEventAction()
|
| 69 |
-
{
|
| 70 |
-
return $this->eventAction;
|
| 71 |
-
}
|
| 72 |
-
|
| 73 |
-
/**
|
| 74 |
-
* Set the Event Category
|
| 75 |
-
*
|
| 76 |
-
* @param string $eventCategory
|
| 77 |
-
*/
|
| 78 |
-
public function setEventCategory($eventCategory)
|
| 79 |
-
{
|
| 80 |
-
$this->eventCategory = $eventCategory;
|
| 81 |
-
}
|
| 82 |
-
|
| 83 |
-
/**
|
| 84 |
-
* Get the Event Category
|
| 85 |
-
*
|
| 86 |
-
* @return string
|
| 87 |
-
*/
|
| 88 |
-
public function getEventCategory()
|
| 89 |
-
{
|
| 90 |
-
return $this->eventCategory;
|
| 91 |
-
}
|
| 92 |
-
|
| 93 |
-
/**
|
| 94 |
-
* Returns the Paket for App Event Tracking
|
| 95 |
-
*
|
| 96 |
-
* @return array
|
| 97 |
-
*/
|
| 98 |
-
public function getPaket()
|
| 99 |
-
{
|
| 100 |
-
return array(
|
| 101 |
-
't' => 'event',
|
| 102 |
-
'an' => $this->getAppName(),
|
| 103 |
-
'ec' => $this->getEventCategory(),
|
| 104 |
-
'ea' => $this->getEventAction()
|
| 105 |
-
);
|
| 106 |
-
}
|
| 107 |
}
|
| 1 |
<?php
|
| 2 |
namespace Racecore\GATracking\Tracking\App;
|
| 3 |
|
| 4 |
+
use Racecore\GATracking\Tracking\Event as DefaultEvent;
|
| 5 |
|
| 6 |
/**
|
| 7 |
* Google Analytics Measurement PHP Class
|
| 19 |
* @url http://www.racecore.de
|
| 20 |
* @package Racecore\GATracking\Tracking\App
|
| 21 |
*/
|
| 22 |
+
class Event extends DefaultEvent
|
| 23 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
}
|
includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/App/Screen.php
CHANGED
|
@@ -21,87 +21,15 @@ use Racecore\GATracking\Tracking\AbstractTracking;
|
|
| 21 |
*/
|
| 22 |
class Screen extends AbstractTracking
|
| 23 |
{
|
| 24 |
-
/** @var string */
|
| 25 |
-
private $appName;
|
| 26 |
-
|
| 27 |
-
/** @var string */
|
| 28 |
-
private $appVersion;
|
| 29 |
-
|
| 30 |
-
/** @var string */
|
| 31 |
-
private $contentDescription;
|
| 32 |
-
|
| 33 |
-
/**
|
| 34 |
-
* Set the Application Name
|
| 35 |
-
*
|
| 36 |
-
* @param string $appName
|
| 37 |
-
*/
|
| 38 |
-
public function setAppName($appName)
|
| 39 |
-
{
|
| 40 |
-
$this->appName = $appName;
|
| 41 |
-
}
|
| 42 |
-
|
| 43 |
-
/**
|
| 44 |
-
* Get the Application Name
|
| 45 |
-
*
|
| 46 |
-
* @return string
|
| 47 |
-
*/
|
| 48 |
-
public function getAppName()
|
| 49 |
-
{
|
| 50 |
-
return $this->appName;
|
| 51 |
-
}
|
| 52 |
-
|
| 53 |
-
/**
|
| 54 |
-
* Set the Application Version
|
| 55 |
-
*
|
| 56 |
-
* @param string $appVersion
|
| 57 |
-
*/
|
| 58 |
-
public function setAppVersion($appVersion)
|
| 59 |
-
{
|
| 60 |
-
$this->appVersion = $appVersion;
|
| 61 |
-
}
|
| 62 |
-
|
| 63 |
-
/**
|
| 64 |
-
* Get the Application Version
|
| 65 |
-
*
|
| 66 |
-
* @return string
|
| 67 |
-
*/
|
| 68 |
-
public function getAppVersion()
|
| 69 |
-
{
|
| 70 |
-
return $this->appVersion;
|
| 71 |
-
}
|
| 72 |
-
|
| 73 |
-
/**
|
| 74 |
-
* Set the Content Description/Screen Name
|
| 75 |
-
*
|
| 76 |
-
* @param string $contentDescription
|
| 77 |
-
*/
|
| 78 |
-
public function setContentDescription($contentDescription)
|
| 79 |
-
{
|
| 80 |
-
$this->contentDescription = $contentDescription;
|
| 81 |
-
}
|
| 82 |
-
|
| 83 |
-
/**
|
| 84 |
-
* Get the Content Description/Screen Name
|
| 85 |
-
*
|
| 86 |
-
* @return string
|
| 87 |
-
*/
|
| 88 |
-
public function getContentDescription()
|
| 89 |
-
{
|
| 90 |
-
return $this->contentDescription;
|
| 91 |
-
}
|
| 92 |
-
|
| 93 |
/**
|
| 94 |
* Returns the Paket for App Screen Tracking
|
| 95 |
*
|
| 96 |
* @return array
|
| 97 |
*/
|
| 98 |
-
public function
|
| 99 |
{
|
| 100 |
return array(
|
| 101 |
't' => 'appview',
|
| 102 |
-
'an' => $this->getAppName(),
|
| 103 |
-
'av' => $this->getAppVersion(),
|
| 104 |
-
'cd' => $this->getContentDescription()
|
| 105 |
);
|
| 106 |
}
|
| 107 |
}
|
| 21 |
*/
|
| 22 |
class Screen extends AbstractTracking
|
| 23 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
/**
|
| 25 |
* Returns the Paket for App Screen Tracking
|
| 26 |
*
|
| 27 |
* @return array
|
| 28 |
*/
|
| 29 |
+
public function createPackage()
|
| 30 |
{
|
| 31 |
return array(
|
| 32 |
't' => 'appview',
|
|
|
|
|
|
|
|
|
|
| 33 |
);
|
| 34 |
}
|
| 35 |
}
|
includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Ecommerce/Item.php
CHANGED
|
@@ -31,10 +31,19 @@ class Item extends AbstractTracking
|
|
| 31 |
private $category = '';
|
| 32 |
private $currency = '';
|
| 33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
/**
|
| 35 |
* Set the Transaction ID
|
| 36 |
*
|
| 37 |
-
* @param $
|
| 38 |
*/
|
| 39 |
public function setTransactionID($tid)
|
| 40 |
{
|
|
@@ -183,26 +192,13 @@ class Item extends AbstractTracking
|
|
| 183 |
return $this->currency;
|
| 184 |
}
|
| 185 |
|
| 186 |
-
public function setTransactionHost($host)
|
| 187 |
-
{
|
| 188 |
-
$this->host = $host;
|
| 189 |
-
return $this;
|
| 190 |
-
}
|
| 191 |
-
|
| 192 |
-
/**
|
| 193 |
-
* @return string
|
| 194 |
-
*/
|
| 195 |
-
public function getTransactionHost()
|
| 196 |
-
{
|
| 197 |
-
return $this->host;
|
| 198 |
-
}
|
| 199 |
-
|
| 200 |
/**
|
| 201 |
-
*
|
| 202 |
*
|
| 203 |
* @return array
|
|
|
|
| 204 |
*/
|
| 205 |
-
public function
|
| 206 |
{
|
| 207 |
if( !$this->getTransactionID() )
|
| 208 |
{
|
|
@@ -222,7 +218,6 @@ class Item extends AbstractTracking
|
|
| 222 |
'iq' => $this->getQuantity(),
|
| 223 |
'ic' => $this->getSku(),
|
| 224 |
'iv' => $this->getCategory(),
|
| 225 |
-
'dh' => $this->getTransactionHost(),
|
| 226 |
'cu' => $this->getCurrency()
|
| 227 |
);
|
| 228 |
}
|
| 31 |
private $category = '';
|
| 32 |
private $currency = '';
|
| 33 |
|
| 34 |
+
/**
|
| 35 |
+
* @param $host
|
| 36 |
+
* @deprecated
|
| 37 |
+
*/
|
| 38 |
+
public function setTransactionHost( $host )
|
| 39 |
+
{
|
| 40 |
+
return $this->setDocumentHost( $host );
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
/**
|
| 44 |
* Set the Transaction ID
|
| 45 |
*
|
| 46 |
+
* @param $tid
|
| 47 |
*/
|
| 48 |
public function setTransactionID($tid)
|
| 49 |
{
|
| 192 |
return $this->currency;
|
| 193 |
}
|
| 194 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 195 |
/**
|
| 196 |
+
* Create the Package
|
| 197 |
*
|
| 198 |
* @return array
|
| 199 |
+
* @throws \Racecore\GATracking\Exception\MissingTrackingParameterException
|
| 200 |
*/
|
| 201 |
+
public function createPackage()
|
| 202 |
{
|
| 203 |
if( !$this->getTransactionID() )
|
| 204 |
{
|
| 218 |
'iq' => $this->getQuantity(),
|
| 219 |
'ic' => $this->getSku(),
|
| 220 |
'iv' => $this->getCategory(),
|
|
|
|
| 221 |
'cu' => $this->getCurrency()
|
| 222 |
);
|
| 223 |
}
|
includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Ecommerce/Transaction.php
CHANGED
|
@@ -29,7 +29,15 @@ class Transaction extends AbstractTracking
|
|
| 29 |
private $shipping = 0;
|
| 30 |
private $tax = 0;
|
| 31 |
private $currency = '';
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
/**
|
| 35 |
* Set the Transaction ID
|
|
@@ -159,35 +167,13 @@ class Transaction extends AbstractTracking
|
|
| 159 |
return $this->currency;
|
| 160 |
}
|
| 161 |
|
| 162 |
-
/**
|
| 163 |
-
* Return the Transaction Host Address
|
| 164 |
-
*
|
| 165 |
-
* @param $host
|
| 166 |
-
* @return $this
|
| 167 |
-
*/
|
| 168 |
-
public function setTransactionHost($host)
|
| 169 |
-
{
|
| 170 |
-
$this->host = $host;
|
| 171 |
-
return $this;
|
| 172 |
-
}
|
| 173 |
-
|
| 174 |
-
/**
|
| 175 |
-
* Returns the Transaction Host
|
| 176 |
-
*
|
| 177 |
-
* @return string
|
| 178 |
-
*/
|
| 179 |
-
public function getTransactionHost()
|
| 180 |
-
{
|
| 181 |
-
return $this->host;
|
| 182 |
-
}
|
| 183 |
-
|
| 184 |
/**
|
| 185 |
* Returns the Google Paket for Transaction Tracking
|
| 186 |
*
|
| 187 |
* @return array
|
| 188 |
* @throws \Racecore\GATracking\Exception\MissingTrackingParameterException
|
| 189 |
*/
|
| 190 |
-
public function
|
| 191 |
{
|
| 192 |
if( !$this->getID() )
|
| 193 |
{
|
|
@@ -201,7 +187,6 @@ class Transaction extends AbstractTracking
|
|
| 201 |
'tr' => $this->getRevenue(),
|
| 202 |
'ts' => $this->getShipping(),
|
| 203 |
'tt' => $this->getTax(),
|
| 204 |
-
'dh' => $this->getTransactionHost(),
|
| 205 |
'cu' => $this->getCurrency()
|
| 206 |
);
|
| 207 |
}
|
| 29 |
private $shipping = 0;
|
| 30 |
private $tax = 0;
|
| 31 |
private $currency = '';
|
| 32 |
+
|
| 33 |
+
/**
|
| 34 |
+
* @param $host
|
| 35 |
+
* @deprecated
|
| 36 |
+
*/
|
| 37 |
+
public function setTransactionHost( $host )
|
| 38 |
+
{
|
| 39 |
+
return $this->setDocumentHost( $host );
|
| 40 |
+
}
|
| 41 |
|
| 42 |
/**
|
| 43 |
* Set the Transaction ID
|
| 167 |
return $this->currency;
|
| 168 |
}
|
| 169 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
/**
|
| 171 |
* Returns the Google Paket for Transaction Tracking
|
| 172 |
*
|
| 173 |
* @return array
|
| 174 |
* @throws \Racecore\GATracking\Exception\MissingTrackingParameterException
|
| 175 |
*/
|
| 176 |
+
public function createPackage()
|
| 177 |
{
|
| 178 |
if( !$this->getID() )
|
| 179 |
{
|
| 187 |
'tr' => $this->getRevenue(),
|
| 188 |
'ts' => $this->getShipping(),
|
| 189 |
'tt' => $this->getTax(),
|
|
|
|
| 190 |
'cu' => $this->getCurrency()
|
| 191 |
);
|
| 192 |
}
|
includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Event.php
CHANGED
|
@@ -127,7 +127,7 @@ class Event extends AbstractTracking
|
|
| 127 |
* @return array
|
| 128 |
* @throws \Racecore\GATracking\Exception\MissingTrackingParameterException
|
| 129 |
*/
|
| 130 |
-
public function
|
| 131 |
{
|
| 132 |
if (!$this->getEventCategory()) {
|
| 133 |
throw new MissingTrackingParameterException('event category musst be set');
|
| 127 |
* @return array
|
| 128 |
* @throws \Racecore\GATracking\Exception\MissingTrackingParameterException
|
| 129 |
*/
|
| 130 |
+
public function createPackage()
|
| 131 |
{
|
| 132 |
if (!$this->getEventCategory()) {
|
| 133 |
throw new MissingTrackingParameterException('event category musst be set');
|
includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Exception.php
CHANGED
|
@@ -74,7 +74,7 @@ class Exception extends AbstractTracking
|
|
| 74 |
*
|
| 75 |
* @return array
|
| 76 |
*/
|
| 77 |
-
public function
|
| 78 |
{
|
| 79 |
return array(
|
| 80 |
't' => 'exception',
|
| 74 |
*
|
| 75 |
* @return array
|
| 76 |
*/
|
| 77 |
+
public function createPackage()
|
| 78 |
{
|
| 79 |
return array(
|
| 80 |
't' => 'exception',
|
includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Page.php
CHANGED
|
@@ -19,94 +19,15 @@ namespace Racecore\GATracking\Tracking;
|
|
| 19 |
*/
|
| 20 |
class Page extends AbstractTracking
|
| 21 |
{
|
| 22 |
-
|
| 23 |
-
private $documentPath = '';
|
| 24 |
-
private $host = '';
|
| 25 |
-
private $title = '';
|
| 26 |
-
|
| 27 |
-
/**
|
| 28 |
-
* Set the Request Document Path
|
| 29 |
-
*
|
| 30 |
-
* @param $path
|
| 31 |
-
*/
|
| 32 |
-
public function setDocumentPath($path)
|
| 33 |
-
{
|
| 34 |
-
|
| 35 |
-
$this->documentPath = $path;
|
| 36 |
-
}
|
| 37 |
-
|
| 38 |
-
/**
|
| 39 |
-
* Returns the Request Document Path
|
| 40 |
-
*
|
| 41 |
-
* @return string
|
| 42 |
-
*/
|
| 43 |
-
public function getDocumentPath()
|
| 44 |
-
{
|
| 45 |
-
|
| 46 |
-
if (!$this->documentPath) {
|
| 47 |
-
return '/';
|
| 48 |
-
}
|
| 49 |
-
|
| 50 |
-
return $this->documentPath;
|
| 51 |
-
}
|
| 52 |
-
|
| 53 |
-
/**
|
| 54 |
-
* Sets the Document Title in Analytics Report
|
| 55 |
-
*
|
| 56 |
-
* @param $title
|
| 57 |
-
*/
|
| 58 |
-
public function setDocumentTitle($title)
|
| 59 |
-
{
|
| 60 |
-
|
| 61 |
-
$this->title = $title;
|
| 62 |
-
}
|
| 63 |
-
|
| 64 |
-
/**
|
| 65 |
-
* Return Document Title
|
| 66 |
-
*
|
| 67 |
-
* @return string
|
| 68 |
-
*/
|
| 69 |
-
public function getDocumentTitle()
|
| 70 |
-
{
|
| 71 |
-
|
| 72 |
-
return $this->title;
|
| 73 |
-
}
|
| 74 |
-
|
| 75 |
-
/**
|
| 76 |
-
* Return the Document Host Adress
|
| 77 |
-
*
|
| 78 |
-
* @param $host
|
| 79 |
-
* @return $this
|
| 80 |
-
*/
|
| 81 |
-
public function setDocumentHost($host)
|
| 82 |
-
{
|
| 83 |
-
$this->host = $host;
|
| 84 |
-
return $this;
|
| 85 |
-
}
|
| 86 |
-
|
| 87 |
-
/**
|
| 88 |
-
* Return Document Host
|
| 89 |
-
*
|
| 90 |
-
* @return string
|
| 91 |
-
*/
|
| 92 |
-
public function getDocumentHost()
|
| 93 |
-
{
|
| 94 |
-
return $this->host;
|
| 95 |
-
}
|
| 96 |
-
|
| 97 |
/**
|
| 98 |
* Returns the Google Paket for Campaign Tracking
|
| 99 |
*
|
| 100 |
* @return array
|
| 101 |
*/
|
| 102 |
-
public function
|
| 103 |
{
|
| 104 |
return array(
|
| 105 |
't' => 'pageview',
|
| 106 |
-
'dh' => $this->getDocumentHost(),
|
| 107 |
-
'dp' => $this->getDocumentPath(),
|
| 108 |
-
'dt' => $this->getDocumentTitle()
|
| 109 |
);
|
| 110 |
}
|
| 111 |
-
|
| 112 |
}
|
| 19 |
*/
|
| 20 |
class Page extends AbstractTracking
|
| 21 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
/**
|
| 23 |
* Returns the Google Paket for Campaign Tracking
|
| 24 |
*
|
| 25 |
* @return array
|
| 26 |
*/
|
| 27 |
+
public function createPackage()
|
| 28 |
{
|
| 29 |
return array(
|
| 30 |
't' => 'pageview',
|
|
|
|
|
|
|
|
|
|
| 31 |
);
|
| 32 |
}
|
|
|
|
| 33 |
}
|
includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/Social.php
CHANGED
|
@@ -101,7 +101,7 @@ class Social extends AbstractTracking
|
|
| 101 |
* @return array
|
| 102 |
* @throws \Racecore\GATracking\Exception\MissingTrackingParameterException
|
| 103 |
*/
|
| 104 |
-
public function
|
| 105 |
{
|
| 106 |
if (!$this->getSocialAction()) {
|
| 107 |
throw new MissingTrackingParameterException('social action musst be set');
|
| 101 |
* @return array
|
| 102 |
* @throws \Racecore\GATracking\Exception\MissingTrackingParameterException
|
| 103 |
*/
|
| 104 |
+
public function createPackage()
|
| 105 |
{
|
| 106 |
if (!$this->getSocialAction()) {
|
| 107 |
throw new MissingTrackingParameterException('social action musst be set');
|
includes/vendor/ga-mp/src/Racecore/GATracking/Tracking/User/Timing.php
CHANGED
|
@@ -232,7 +232,7 @@ class Timing extends AbstractTracking
|
|
| 232 |
*
|
| 233 |
* @return array
|
| 234 |
*/
|
| 235 |
-
public function
|
| 236 |
{
|
| 237 |
return array(
|
| 238 |
't' => 'timing',
|
| 232 |
*
|
| 233 |
* @return array
|
| 234 |
*/
|
| 235 |
+
public function createPackage()
|
| 236 |
{
|
| 237 |
return array(
|
| 238 |
't' => 'timing',
|
