Google Analytics

For those clients that useGoogle Analytics, Mobi2Go provides tracking of events using the Google Analytics enhanced ecommerce plugin with analytics.js.

In order to enable this feature for clients, you'll need to contact us with the tracking ID of the Google Analytics property (a string similar to 'UA-XXXXX-Y').

As per the Google documentation, an event sent to Google Analytics has a signiture as follows:

ga('send', 'event', [eventCategory], [eventAction], [eventLabel], [eventValue], [fieldsObject]);

The events we send are detailed below -- more information about event tracking can be found the Google Analytics documentation.

// when last order button is clicked
ga('send', 'event', 'order', 'load last order', lastOrderState.id);

// when the user chooses a location
ga('send', 'event', 'location', 'set location', location.name);

// when the user is logged in
ga('set', {userId: customer.id});

// when the user views a menu category
ga('send', 'event', 'menu', 'view category', category.name);

    // set the ecommerce action
    ga('ec:setAction', 'detail')

    // add each product in the menu category as an impression
    ga('ec:addImpression', {
        id: menu_product.id,
        name: menu_product.name,
        list: list_name,
        category: menu_product.category ? menu_product.category.name : null,
        position: position
    });


// when a user views a menu
ga('send', 'event', 'menu', 'view menu', menu.name);

    // set the ecommerce action
    ga('ec:setAction', 'detail')

    // add each product in the menu category as an impression
    ga('ec:addImpression', {
        id: menu_product.id,
        name: menu_product.name,
        list: list_name,
        category: menu_product.category ? menu_product.category.name : null,
        position: position
    });


// when a user edits a product
ga('send', 'event', 'menu', 'edit product', product.menu_product.name);

    // set the ecommerce action
    ga('ec:setAction', 'detail')

    // detail the product
    ga('ec:addProduct', {
        id: product.menu_product.id,
        name: product.menu_product.name,
        price: product.price.toFloat(),
        quantity: product.quantity,
        variant: product.size ? product.size.menu_modifier.name : null,
        category: product.menu_product.category
            ? product.menu_product.category.name
            : null,
        position: product.menu_product.category_list_position
            ? product.menu_product.category_list_position
            : null
    });


// when a user adds a product to their cart
ga('send', 'event', 'order', 'add product', product.menu_product.name);

    // set the ecommerce action
    ga('ec:setAction', 'add')

    // detail the product
    ga('ec:addProduct', {
        id: product.menu_product.id,
        name: product.menu_product.name,
        price: product.price.toFloat(),
        quantity: product.quantity,
        variant: product.size ? product.size.menu_modifier.name : null,
        category: product.menu_product.category
            ? product.menu_product.category.name
            : null,
        position: product.menu_product.category_list_position
            ? product.menu_product.category_list_position
            : null
    });


// when a user removes a product from their cart
ga('send', 'event', 'order', 'remove product', product.menu_product.name);

    // set the ecommerce action
    ga('ec:setAction', 'remove')

    // detail the product
    ga('ec:addProduct', {
        id: product.menu_product.id,
        name: product.menu_product.name,
        price: product.price.toFloat(),
        quantity: product.quantity,
        variant: product.size ? product.size.menu_modifier.name : null,
        category: product.menu_product.category
            ? product.menu_product.category.name
            : null,
        position: product.menu_product.category_list_position
            ? product.menu_product.category_list_position
            : null
    });


// when an order has been completed
ga('send', 'event', 'order', 'payment');

// when the user starts checkout
ga('send', 'event', 'order', 'checkout');
ga('send', 'event', 'order', 'confirmed');

// when a user starts payment
ga('send', 'event', 'order', 'start payment', order.getId());

// when the credit card details are saved
ga('send', 'event', 'order', 'save credit card');
Have more questions? Submit a request

Comments