Where can I Find the Track&Engage Tracking Code?
The Track&Engage Tracking code looks as follows:
Customize the Page Name Displayed in Track&Engage
A common use is to set the HTML Title value as the document title:
_egoiaq.push(['setDocumentTitle', document.title]); _egoiaq.push(['trackPageView']);
By default, Track&Engage uses the URL of the current page as the page title in the Track&Engage interface.
_egoiaq.push(['setDocumentTitle', document.domain + "/" + document.title]); _egoiaq.push(['trackPageView']);
Advanced users can also dynamically generate the page name, for example, in PHP:
_egoiaq.push(['setDocumentTitle', "<?php echo $myPageTitle ?>"]); _egoiaq.push(['trackPageView']);
Manually Trigger a Page View on Click or on JS Event
Manually Trigger a Conversion for a Goal
// logs a conversion for goal 1 _egoiaq.push(['trackGoal', 1]);
You can also register a conversion for this goal with a custom revenue. For example, you can generate the call to trackGoal dynamically to set the revenue of the transaction:
/* logs a conversion for goal 1 with the custom revenue set */ _egoiaq.push(['trackGoal', 1, <?php echo $cart->getCartValue(); ?>]);
By default, Goals in Track&Engage are defined as “matching” parts of the URL (starts with, contains, or regular expression matching). You can also track goals for given page views, downloads, or outlink clicks.
In some situations, you may want to register conversions on other types of actions, for example:
- when a user submits a form
- when a user has stayed more than a given amount of time on the page
- when a user does some interaction in your Flash application
- when a user has submitted his cart and has done the payment: you can give the Track&Engage tracking code to the payment website which will then register the conversions in your Track&Engage database, with the conversion’s custom revenue
Tracking Ecommerce Orders, Cart Updates and Product/Category Page Views
Track&Engage allows for advanced and powerful Ecommerce tracking.
Check out the Ecommerce Analytics documentation for more information about Ecommerce reports and how to set up Ecommerce tracking.
Tracking internal Search Keywords, categories, and No Result Search Keywords
_egoiaq.push(['trackSiteSearch', // Search keyword searched for "Banana", // Search category selected in your search engine. If you do not need this, set to false "Organic Food", // Number of results on the Search results page. Zero indicates a 'No Result Search Keyword'. Set to false if you don't know 0 ]); // We recommend not to call trackPageView() // on the Site Search Result page _egoiaq.push(['trackPageView']);
In your website, in standard pages, you would typically have a call to record Page views via trackPageView(). On your search result page, you would call instead trackSiteSearch(keyword, category, searchCount) function to record the internal search request.
We also highly recommend to set the searchCount parameter, as Track&Engage will specifically report “No Result Keywords”, ie. Keywords that were searched, but did not return any result. It is usually very interesting to know what users search for but can’t find (yet?) on your website.
Egoimmerce Analytics Documentation
Once you have enabled Ecommerce tracking for a website, you need to implement tracking of the various Ecommerce interactions on your website. There are three main Ecommerce interactions that are tracked with Egoimmerce:
- Ecommerce Orders (and products)
- Ecommerce Cart update (and products)
- Product (and/or category) page views
Tracking Ecommerce Orders & Items Purchased (required)
Here’s an example of tracking an Ecommerce order containing two products – this code should be inserted in the “Order confirmation” page, once the visitor has checked out and issued payment. If you installed Egoimmerce correctly, your pages should already have a tracking code. The Ecommerce code below must be added and generated based on the Order:
// add the first product to the order _egoiaq.push(['addEcommerceItem', "9780786706211", // (required) SKU: Product unique identifier "Endurance: Shackleton's Incredible Voyage", // (optional) Product name "Adventure Books", // (optional) Product category. You can also specify an array of up to 5 categories eg. ["Books", "New releases", "Biography"] 8.8, // (recommended) Product price 1 // (optional, default to 1) Product quantity ]); // Here you can add other products in the order [...] // Specifiy the order details to Egoimmerce server & sends the data to Egoimmerce server _egoiaq.push(['trackEcommerceOrder', "A10000123", // (required) Unique Order ID 35, // (required) Order Revenue grand total (includes tax, shipping, and subtracted discount) 30, // (optional) Order sub total (excludes shipping) 5.5, // (optional) Tax amount 4.5, // (optional) Shipping amount false // (optional) Discount offered (set to false for unspecified parameter) ]); // we recommend to leave the call to trackPageView() on the Order confirmation page _egoiaq.push(['trackPageView']);
Tracking Ecommerce orders and product details will allow Egoimmerce to process reports on:
- Product SKU
- Product name
- Top Product categories and general overview of Ecommerce performance in your online shop
- addEcommerceItem(productSKU, productName, productCategory, price, quantity) This adds a product into the order, and must be called for each product in the order. productSKU is a required parameter, it is also recommended that you send other parameters if they are applicable in your Ecommerce shop.
- trackEcommerceOrder(orderId, grandTotal, subTotal, tax, shipping, discount) This tracks an Ecommerce order and sends the data to your Egoimmerce server, for both this order and products previously added. Only orderId and grandTotal (ie. revenue) are required.
Important notes about the functions parameters:
- orderId parameter is a unique string identifier for the order. If the page containing the trackEcommerceOrder() call is refreshed by the customer a few hours or days after the initial Order, Egoimmerce will automatically discard the order as it is already recorded. You can use the same orderId for different Websites id, but for a given website, orderId must be unique.
Tracking Add to Cart & Items Added to the Cart (optional)
time a visitor adds (or updates, deletes) an item from his/her cart, you can use Egoimmerce to track the latest cart subtotal as well as products left in the cart. Tracking cart updates will allow you to see how much revenue was left in your visitors’ carts for each day/week/etc, as well as getting reports on which products are most often left in the cart and which product categories are most often left abandoned in carts.
Some frequent causes for cart abandonment are:
- high shipping prices,
- complicated forms for new users (lack of “Anonymous checkout” option),
- complicated / lengthy checkout process,
- slow website,
- visitor was just browsing the site or wanted to compare total cost with competitor.
When you make changes to your website to lower the cart abandonment rate, and try to increase your revenues, you can use Egoimmerce to understand if your changes are making a positive impact.
Example tracking an Ecommerce order containing two products:
The code is added every time the “cart” page is loaded, or when the “Add to cart” button is clicked:
// add the first product to the order _egoiaq.push(['addEcommerceItem', "9780786706211", // (required) SKU: Product unique identifier "Endurance: Shackleton's Incredible Voyage", // (optional) Product name ["Adventure Books", "Best sellers"], // (optional) Product category, string or array of up to 5 categories 8.8, // (recommended) Product price 1 // (optional, default to 1) Product quantity ]); // Here it is important to add all other products found in the cart, even the products not updated by the current "Add to cart" click [...] // Records the cart for this visit _egoiaq.push(['trackEcommerceCartUpdate', 15.5]); // (recommended) Cart amount _egoiaq.push(['trackPageView']);
Tracking Product Page Views & Category Page Views (optional)
Tracking product page views, and/or category page views lets Egoimmerce process the conversion rate for each product and/or category. It can be useful to know which product or category pages have converted your visitors into customers. For example, perhaps some product pages have below average conversion rates but generate high revenue. You may decide to improve these product pages and check their conversion rates over time.
To track a product or category page view, the function setEcommerceView(productSKU, productName, categoryName, price) is used, just before the call to egoimmerceTracker.trackPageView() on the product/category page.
Example Tracking a Product Page View
In this example, the following code is added to the Product page for the book “Endurance” which is in the category “Adventure Books”:
// all parameters are optional, but we recommend to set at minimum productSKU and productName _egoiaq.push(['setEcommerceView', "9780786706211", // (required) SKU: Product unique identifier "Endurance: Shackleton's Incredible Voyage", // (optional) Product name "Adventure Books", // (optional) Product category, or array of up to 5 categories 20.11 // (optional) Product Price as displayed on the page ]); _egoiaq.push(['trackPageView']);
Example tracking a Category page view
This code is added on the Category page “Adventure Books”
// on a category page, productSKU and productName are not applicable and are set to false _egoiaq.push(['setEcommerceView', productSku = false, // No product on Category page productName = false, // No product on Category page category = "Adventure Books" // Category Page, or array of up to 5 categories ]); _egoiaq.push(['trackPageView']);