Pages

Monday, February 7, 2011

Coremetrics tags in Websphere Commerce

What you need (For all coremetrics tags) :

1.       Coremetrics Client Id – This is the unique id assigned to your company

2.       Coremetrics data collection domain – Domains are defined for data collection. For example testdata.coremetrics.com is for collecting test data. Please ask coremetrics about your data domain.

3.       Coremetrics Domain – This usually is your Company’s domain name like XXXXXX.com


Creating a coremetrics pageView tag in websphere commerce

The javascript function is cmCreatePageviewTag()
The parameters to be passed to this tag are

1.       Pagename: Specify the page name. Uses html page title automatically if not provided. This is optional

2.       Category: specifies the category of the page. If not provided then nothing is sent to coremetrics.

3.       searchTerms: if it is a search results page, then specifies the search terms. Required parameter for a search results page

4.       searchCount: specifies the total number of results returned by the search

5.       StoreId: is the wcs store Id. If not specified then it looks for storeId parameter in the URL


Eg:

Include couple of java scripts at the end of the page where pagview tag is to be placed


<script language="JavaScript1.1" type="text/JavaScript" src="//libs.coremetrics.com/eluminate.js"></script>

<script language="JavaScript1.1" type="text/JavaScript" src="/wcsstore/coremetrics/cmcustom.js"></script>



Set the coremetrics required parameters like client id, domain etc.


<script language="JavaScript1.1" type="text/JavaScript">
<!--                     
cmSetClientID("<%=MyConfig.getConfigValue(COREMETRICS_CLIENTID)%>",                                    "<%=MyConfig.getConfigValue(COREMETRICS_DATA_COLLECTION_DOMAIN)%>",                         "<%=MyConfig.getConfigValue(COREMETRICS_DOMAIN)%>");
//-->

</script>

<script language="JavaScript1.1" type="text/JavaScript">
<!--
cmCreatePageviewTag("Page Name", null, null, null, "${WCParam.storeId}");
//-->                                                          
</script>


Where “Page Name” is the name of the page and if left blank will be populated with HTML page title. Store ID can be fetched from the WCParam parameter.

Creating a coremetrics productView tag in websphere commerce

This tag is included on the product detail page to capture product views in the coremetrics reports

The function used is cmCreateProductviewTag(). This tag is included on the product detail page to capture product views in the coremetrics reports

Parameters that needs to be passed to this tag are:

ProductId: Include either the catentry_Id here or the partnumber (SKU Id) as per the requirements. It generally is partnumber. This is a mandatory field

Name: include the product name. This is a mandatory field

categoryId: include the category Id to which this product belongs to. If you are using endeca for navigation, the category id of endeca might not match with what is in WCS. Hence, you need to include the correct categoryId here depending on what you have in your Coremetrics Data File (CDF) that was supplied to coremetrics initially. The CDF file contains the list of category mappings (hierarchy).

storied – this is the store id of wcs. Use WCParam to get the store Id


More on cart view tags (cmCreateShopAction5) in next blog

No comments:

Post a Comment