function test_send_products_impression() { $page = (new Page())->setDocumentPath('/products/product-1-2')->setDocumentTitle('Product 1 & 2 Page'); $product1 = Product::create(5346, 'product 1', 45); $product2 = Product::create(5347, 'product 2', 47); $list1 = new ImpressionList('list 1', 1, $product1); $list2 = new ImpressionList('list 2', 2, $product2); Analytics::create($this->config)->impression($page)->setList($list1)->setList($list2)->send(); }
function test_send_simple_exception() { Analytics::create($this->config)->exception('An error occurred')->send(); }
public function test_send_advanced_event() { Analytics::create($this->config)->event('Advanced Event Group', 'Advanced Event Action')->api()->setDocumentPath('/event/document/path')->sendEvent(); }
/** * Sends page view with additional methods from API */ function test_send_advanced_page_view() { $path = '/advanced/page/view'; $title = 'Advanced Page View'; Analytics::create($this->config)->page($path, $title)->api()->setDocumentLocationUrl('location/url')->setClientId('234235')->sendPageview(); }
/** * @param $transactionID * @return Transaction */ private function getTransactionInstance($transactionID) { $transactionID = $transactionID . '-' . rand(1000, 5000); $affiliation = 'Affiliate ' . rand(100, 500); $revenue = rand(40, 999); $tax = rand(1, 20); $shipping = rand(0, 5); $coupon = '10OFF'; return Analytics::create($this->config)->transaction($transactionID, $affiliation, $revenue, $tax, $shipping, $coupon)->setProduct(Product::create('SHIRT-324', 'Shirt', 22.99)); }