diff --git a/src/Tracker.php b/src/Tracker.php index b3bb648..6114c1f 100644 --- a/src/Tracker.php +++ b/src/Tracker.php @@ -22,10 +22,17 @@ * @method static string trackInitiateCheckout(array $products, $step, $currency = 'USD') * @method static string trackAddPaymentInformation() * @method static string trackTransaction(array $products, $transactionId, $revenue, $tax, $shipping, $currency = 'USD') - * @method static string trackLead($value = null, $currency= 'USD') + * @method static string trackLead($value = null, $currency = 'USD') */ class Tracker { + public static function queue(callable $function) + { + $function(); + + self::__callStatic('queue', []); + } + /** * @param $name * @param $arguments diff --git a/src/TrackingProviders/FacebookPixelTrackingProvider.php b/src/TrackingProviders/FacebookPixelTrackingProvider.php index 80fd10a..26efc13 100644 --- a/src/TrackingProviders/FacebookPixelTrackingProvider.php +++ b/src/TrackingProviders/FacebookPixelTrackingProvider.php @@ -9,16 +9,17 @@ class FacebookPixelTrackingProvider protected static $headBottom = ''; protected static $bodyTop = ''; - public static function queue(callable $function) + public static function queue() { - $function(); - session( [ self::SESSION_PREFIX . 'headBottom' => self::$headBottom, self::SESSION_PREFIX . 'bodyTop' => self::$bodyTop ] ); + + self::$headBottom = ''; + self::$bodyTop = ''; } public static function headBottom() diff --git a/src/TrackingProviders/GoogleAdWordsTrackingProvider.php b/src/TrackingProviders/GoogleAdWordsTrackingProvider.php index 3a716f8..5a4c9ab 100644 --- a/src/TrackingProviders/GoogleAdWordsTrackingProvider.php +++ b/src/TrackingProviders/GoogleAdWordsTrackingProvider.php @@ -8,11 +8,11 @@ class GoogleAdWordsTrackingProvider protected static $bodyTop = ''; - public static function queue(callable $function) + public static function queue() { - $function(); - session([self::SESSION_PREFIX . 'bodyTop' => self::$bodyTop]); + + self::$bodyTop = ''; } public static function bodyTop() diff --git a/src/TrackingProviders/GoogleAnalyticsTrackingProvider.php b/src/TrackingProviders/GoogleAnalyticsTrackingProvider.php index bc0878c..0a42443 100644 --- a/src/TrackingProviders/GoogleAnalyticsTrackingProvider.php +++ b/src/TrackingProviders/GoogleAnalyticsTrackingProvider.php @@ -9,16 +9,17 @@ class GoogleAnalyticsTrackingProvider protected static $headTop = ''; protected static $headBottom = ''; - public static function queue(callable $function) + public static function queue() { - $function(); - session( [ self::SESSION_PREFIX . 'headTop' => self::$headTop, self::SESSION_PREFIX . 'headBottom' => self::$headBottom ] ); + + self::$headTop = ''; + self::$headBottom = ''; } /**