Monitus UI Library

Yahoo!  4

Monitus UI Library > yahoo > MUI.yahoo
Search:
 
Filters

static Class MUI.yahoo

The YAHOO module provides utilities to be used on Yahoo! stores.

Methods

badge_products

static void badge_products ( pProductIDs , pBadgeURL , pPosition )
Badge images by product ID: adds an image (badge) over another image (target); target images are identified by product IDs.
Parameters:
pProductIDs <string|array> string of comma-separated product IDs, OR an array of product IDs (strings).
pBadgeURL <url> url of the badge image; the image should be a file with a transparent background.
pPosition <string> one of: MUI.util.ktop_right (default), MUI.util.ktop_center, MUI.util.ktop_left, MUI.util.kbottom_right, MUI.util.kbottom_center or MUI.util.kbottom_left
Returns: void

checkout_button_caption_swap

static void checkout_button_caption_swap ( pButtonName , pNewCaption )
Changes a checkout button's caption.
Parameters:
pButtonName <string> the name of the button that will be targeted. (input of type "submit")
pNewCaption <url> the new caption for the button.
Returns: void

checkout_button_image_swap

static void checkout_button_image_swap ( pImageName , pNewImageURL )
Changes the image of a checkout button.
Parameters:
pImageName <string> the name of the image that will be swapped. (input of type "button")
pNewImageURL <url> the url of the image to load instead.
Returns: void

checkout_create_date_fields_for_field

static void checkout_create_date_fields_for_field ( pFieldID )
Creates 3 fields (MM / DD / YYYY) to enter dates, and will update the original field's value accordingly. The original field is usually a hidden field.
Parameters:
pFieldID <string> the ID of the parent field, normally a hidden field.
Returns: void

checkout_create_new_section

static void checkout_create_new_section ( pBeforeSectionID , pNewSectionID , pTitle , pSubTitle )
Create a new section on the checkout page. The new section will be added before the placeholder section.
Parameters:
pBeforeSectionID <string> the ID of the section to use a a placeholder.
pNewSectionID <string> the ID of the new section.
pTitle <string> the title of the new section.
pSubTitle <string> the title of the new section's first sub-section.
Returns: void

checkout_duplicate_button

static void checkout_duplicate_button ( pNewNextSiblingID , pTargetName , pAppend )
Duplicate a button on the checkout page. The new button will be added before or after the placeholder element.
Parameters:
pNewNextSiblingID <string> the ID of the placeholder.
pTargetName <string> the NAME of the button to duplicate.
pAppend <bool> place the copied button before (false, default) or after (true) the placeholder.
Returns: void

checkout_duplicate_field

static void checkout_duplicate_field ( pNewNextSiblingID , pTargetID , pActiveLinkID , pFocus , pHideOriginal )
Duplicate a field on a checkout page.
Parameters:
pNewNextSiblingID <string> the ID of the placeholder element.
pTargetID <string> the ID of the targeted element.
pActiveLinkID <string> the ID of the *field* element.
pFocus <bool> should the new field have focus?
pHideOriginal <bool> should the original copy be hidden?
Returns: void

checkout_mandatory_to_optional_field

static void checkout_mandatory_to_optional_field ( pTargetID , pActiveLinkID , pEmptyValue )
Make a Yahoo!-mandatory field optional, like the Phone field on the checkout...
Parameters:
pTargetID <string> the ID of the targeted element.
pActiveLinkID <string> the ID of the *field* element.
pEmptyValue <string> the value to place int he field so Y! thinks it is not empty.
Returns: void

checkout_move_subsection

static void checkout_move_subsection ( pSubSectionID , pNewSectionID , pPosition )
Move a subsection to another section on the checkout page. The subsection will be added before the subsection at position "position".
Parameters:
pSubSectionID <string> the ID of the section to move.
pNewSectionID <string> the ID of the new section to move it to.
pPosition <number> the position of the moved subsection in the new section; zero-based.
Returns: void

cleanup_order_data

static void cleanup_order_data ( )
Builds new order variables that are cleaned-up. On the confirmation page, Yahoo! gives javascript developers a series of variables that hold the items ordered, quantity ordered, etc... Except that it does not create a list of unique product IDs. So if a customer orders a product, but with different options, for instance, this creates 2 lines in Yahoo!'s arrays, even though we do not have the actual options that could differentiate the ordered items... So this function makes sure that this product will only show once in the list of ordered products, and adjusts the quantity accordingly. Note: This also considered the price of the items. So if certain options cost more, then the product will be kept on two lines. The new arrays to use are: mon_order_ids, mon_order_items, mon_order_codes, mon_order_price, mon_order_qtys
Returns: void

clear_referrer_for_redirect

static void clear_referrer_for_redirect ( )
Clear the saved referrer from the cookies; should be called as soon as you have used the referrer info.
Returns: void

cookie_domain

static string cookie_domain ( pDomain )
Get a broad enough domain to be used for cookies on a Yahoo! store.
Parameters:
pDomain <string> the domain OR null OR "auto". If not null, this simply returns the passed domain.
Returns: string
a domain broad enough to be used for store cookies.

coupon_apply

static void coupon_apply ( pCoupon )
Automatically apply a coupon code to the current cart; useful to use as links on coupon codes. This will not only set the coupon code in the right field, it will also hit the "Apply" button for the user, so the coupon is actually applied.
Parameters:
pCoupon <string> the coupon code to apply.
Returns: void

coupon_pusher

static void coupon_pusher ( pText , pImage , pPopUpID , pPopUpFc )
Push coupon(s) through a non-blocking pop-up. The button will be added right after the coupon field on the checkout.
Parameters:
pText <string> title of the button to show the coupon(s) pop-up.
pImage <url> url of the image used on the button. Optional.
pPopUpID <string> id of the div to show as the pop-up content. If the div does not exist, one will be created.
pPopUpFc <function> function to be called when the button is clicked.
Returns: void

create_ga_tracking_object

static object create_ga_tracking_object ( pProfileID , pIgnoredReferers , pMaxVars , pSessionTimeout )
Create a Monitus-compatible tracking object for Google Analytics. This ensures that your tracking object does not interfere with the Monitus one, or pollute the cookie space, etc...

This call will also automatically grab and use the saved referrer, if set.

If the Facebook or Twitter javascript objects exists when the object is created, Social NEtowrk tracking will happen automatically.

Parameters:
pProfileID <string> the GA profile ID (UA-xxxxxx-x)
pIgnoredReferers <array> list of ignored referrers; maps to GA's "_addIgnoredRef" function. Optional.
pMaxVars <number> maximum number of custom variables allowed on the page; maps to GA's "_setMaxCustomVariables" function. Optional.
pSessionTimeout <number> session timeout value; maps to GA's "_setSessionCookieTimeout" function. Optional.
Returns: object
a GA tracker object.

create_pop_up

static button create_pop_up ( pText , pImage , pPlaceholderID , pPopUpID , pPopUpFc )
Create a pop-up div; these pop-ups are not blocked by pop-up blockers, as they are not in a separate window. This version (as opposed to MUI.util.create_popup) will center the popup on the screen by default.
Parameters:
pText <string> title of the button to show the pop-up.
pImage <url> url of the image used on the button. Optional.
pPlaceholderID <string> id of the element into which the button shoudl be placed.
pPopUpID <string> id of the div to show as the pop-up content. If the div does not exist, one will be created.
pPopUpFc <function> function to be called when the button is clicked. Optional; by default, this function centers the popup on the screen. Note: For the automatic popUp function to work, make sure the YAHOO.util.Dom library is loaded on the page.
Returns: button
a reference to the created button; the button will have a "popup" property, for quick access to the popup div.

current_page_id

static object current_page_id ( )
Grab the current page's ID; on the store domain, will be the product ID. On the checkout side, it will be the "sectionId" value. (ysco.cart, ysco.ship-bill, ...)
Returns: object
the current page's ID.

install_track_cart_update

static void install_track_cart_update ( pTrackerObject , pVariableSlot , pOptionalVariableName , pOptionalVariableScope )
Attaches an onclick event handler to the "Update" button on the cart page, so the click can be tracked as an event in Google Analytics.
Parameters:
pTrackerObject <string|object> the name of the tracker object variabl, or the actual tracker object.
pVariableSlot <number> the variable's slot number. (1-5)
pOptionalVariableName <string> the vairable's name. Default: "Crt"
pOptionalVariableScope <number> the variable's scope. One of: MUI.ga.kvariable_scope_visitor, MUI.ga.kvariable_scope_session or MUI.ga.kvariable_scope_page. Default: MUI.ga.kvariable_scope_session
Returns: void

install_track_ship_update

static void install_track_ship_update ( pTrackerObject , pOptionalEventCategory , pOptionalEventAction , pOptionalEventLabel , pNonInteraction )
Attaches an onclick event handler to the Shipping Calculator button on the checkout, so the click can be tracked as an event in Google Analytics.
Parameters:
pTrackerObject <string|object> the name of the tracker object variabl, or the actual tracker object.
pOptionalEventCategory <string> the category for this event; can be an inflatable template. Default: "Update Shipping - [page ID] page'"
pOptionalEventAction <string> the action for this event; can be an inflatable template. Default: "[zip code] - [state] - [shipping method]"
pOptionalEventLabel <string> the label for this event; can be an inflatable template. Default: "Checkout Button Clicked"
pNonInteraction <bool> when false, event has an impact on bounce rate. When true, the event will not be used in bounce rate calculations. Default: "true"
Returns: void

keep_shopping_handler

static void keep_shopping_handler ( pOptionalTrackerObject , pOptionalEventCategory , pOptionalEventAction , pOptionalEventLabel , pNonInteraction )
"Keep Shopping" Handler: for one-page carts, make sure the "Keep Shopping" link works and takes the customer back to the last store page they saw before coming ot the checkout.
Parameters:
pOptionalTrackerObject <string|object> the name of the tracker object variabl, or the actual tracker object. Default: null (no event tracking);
pOptionalEventCategory <string> the category for this event; can be an inflatable template. Default: "[page ID]'"
pOptionalEventAction <string> the action for this event; can be an inflatable template. Default: ""
pOptionalEventLabel <string> the label for this event; can be an inflatable template. Default: "Add to Cart"
pNonInteraction <bool> when false, event has an impact on bounce rate. When true, the event will not be used in bounce rate calculations. Default: "true"
Returns: void

save_referrer_for_redirect

static void save_referrer_for_redirect ( )
Save the current referrer in a cookie, so it can be read later. Particularely useful for javascript redirects: use this before you do the redirect, and then use MUI.util.cookie_value("_mrrf", null); on the new landing page to grab the initial referrer. Note: since this mechanism uses cookies, it will only work if the redirect happens on the same root domain.
Returns: void

track_add_to_cart

static true track_add_to_cart ( pTrackerObject , pOptionalEventCategory , pOptionalEventAction , pOptionalEventLabel , pNonInteraction )
Track an event when the user clicks the "Add to cart" button. To be used in an "onclick" function.
Parameters:
pTrackerObject <string|object> the name of the tracker object variabl, or the actual tracker object.
pOptionalEventCategory <string> the category for this event; can be an inflatable template. Default: "[page ID]'"
pOptionalEventAction <string> the action for this event; can be an inflatable template. Default: ""
pOptionalEventLabel <string> the label for this event; can be an inflatable template. Default: "Add to Cart"
pNonInteraction <bool> when false, event has an impact on bounce rate. When true, the event will not be used in bounce rate calculations. Default: "true"
Returns: true
returns TRUE so it can easily be used in an onclick or onsubmit handler.

track_click_to_enlarge

static true track_click_to_enlarge ( pTrackerObject , pOptionalEventCategory , pOptionalEventAction , pOptionalEventLabel , pNonInteraction )
Track an event when the user clicks a "Click to enlarge" button. To be used in the "onclick" function.
Parameters:
pTrackerObject <string|object> the name of the tracker object variabl, or the actual tracker object.
pOptionalEventCategory <string> the category for this event; can be an inflatable template. Default: "[page ID]'"
pOptionalEventAction <string> the action for this event; can be an inflatable template. Default: "clicked"
pOptionalEventLabel <string> the label for this event; can be an inflatable template. Default: "Click to enlarge"
pNonInteraction <bool> when false, event has an impact on bounce rate. When true, the event will not be used in bounce rate calculations. Default: "true"
Returns: true
returns TRUE so it can easily be used in an onclick or onsubmit handler.


Copyright © 2013 Yahoo! Inc. All rights reserved.