Skip to content

Instantly share code, notes, and snippets.

@mona87
Last active January 18, 2016 21:55
Show Gist options
  • Save mona87/a12f5f6be42676df1d9b to your computer and use it in GitHub Desktop.
Save mona87/a12f5f6be42676df1d9b to your computer and use it in GitHub Desktop.
Monetate Pagetype Tags

###SetPageType SetPageType API

The setPageType method is used to set a page type that describes the type of page a visitor views on your site. Page types are used to consistently target actions and are a helpful alternative to manual URL targeting.

// setPageType Method
  window.monetateQ.push([
 "setPageType",
 "idString"
]);
// setPageType Example
  window.monetateQ.push([
 "setPageType",
 "main"
]);

###Examples of Page Types

####Useful Methods addCategories

The addCategories method is an array of strings that allows you to add identifiers to a trackData call. These strings have no connection to products or items and they do not necessarily represent groupings of products or services from a catalog; however, this method could be used to indicate that the visitor is currently on a page that is displaying products from a certain category.

// addCategories Method
window.monetateQ.push([
 "addCategories",
 ["string", "string", "string"]
]);

addProducts

The addProducts method is used to add items a user views on index or search pages. These are generally smaller thumbnail images that lead a user to more detailed information about that product.

// addProducts Method
window.monetateQ.push([
 "addProducts",
 ["pidString", 
  "pidString", 
  "pidString"]
]);

An example using addCategories and addProducts in conjunction with setPageType

window.monetateQ = window.monetateQ || [];
	
window.monetateQ.push(["setPageType", "index"]);
	
window.monetateQ.push([“addCategories", “shirts"]);
	
window.monetateQ.push(["addProducts", 
 ["25503585","25795715",
 "25591978","25591412",
 "25591289","25591923",
 "25591189"]]);
window.monetateQ.push(["trackData"]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment