Comparison of the extraparms
, extraparmsMap
,
and orderExtraparms
parameters when used for IBM Digital Analytics
The WebSphere Commerce order tag (<cm:order
/>
) and shopping cart tag (<cm:cart />
)
support multiple parameters that you can use to pass additional data
to IBM Digital Analytics, formerly known
as Coremetrics Analytics.
Those parameters are extraparms
, extraparmsMap
,
and orderExtraparms
(orderExtraparms
is
applicable only to the order tag). It is important to understand which
parameter to choose so that you get the results you expect in the
generated IBM Digital Analytics data
tags.
Parameter | When to use |
---|---|
extraparms |
Use when you want to append the same values
to all catalog entries in the order.
|
extraparmsMap |
Use when you want to append different values
to specific catalog entries in the order,
as defined in a hash map. This parameter is an alternative to the extraparms parameter
when you need the additional function of the hash map.
|
orderExtraparms |
Use when you want to append values to the order. This parameter is supported by
the |
extraparms
values.
If your store is not on WebSphere Commerce Version 7 Feature Pack
3 or later, you must specify the values using properly escaped JavaScript: - Simplified syntax example
extraparms="value1-_-value2,value3-_-value4"
- Properly escaped JavaScript example
extraparms="\"value1-_-value2\",\"value3-_-value4\""
If any of your extraparms
values
are JavaScript variables, see the syntax rules explained in Syntax for passing JavaScript variables as extra parameters.
Example of extraparms
parameter usage
The
following shows an example of how you would include a WebSphere Commerce
analytics tag with the extraparms
parameter in a
store page: <cm:order orderId="${WCParam.orderId}" extraparms="null,attr1-_-attr2"/>
In
this example, the previous sample code generates the following cmCreateShopAction9Tag
data
tags for two catalog entries in the order (note that the <order
/>
tag also generates the cmCreateOrderTag
data
tag, but it is not shown in this example):
cmCreateShopAction9Tag ("KICO-02", "Flavour-Fantasy Gift Set",
"1.0", "43.58", "1502", "15501", "51.51", "10025", null, "attr1-_-attr2")
cmCreateShopAction9Tag ("KIAC-03", "Rolling Pin",
"1.0", "7.93", "1502", "15501", "51.51", "10025", null, "attr1-_-attr2")
cmCreateShopAction9Tag
output examples,
the extraparms
parameter generated the following
data for both catalog entries in the order:null, "attr1-_-attr2"
extraparms
values, see:Example extraparmsMap
parameter usage
To
append different values to specific catalog entries, you must pass
an object of type java.util.HashMap as the value for extraparmsMap
.
The key of the map is the orderItemId
and the value
is the extra parameter that you want to pass for that catalog entry. The
following sample code shows how you might use the extraparmsMap
parameter
with a WebSphere Commerce analytics tag in a store page; note that
the code to create the java.util.HashMap object precedes the WebSphere
Commerce analytics tag:
<wcf:getData type="com.ibm.commerce.order.facade.datatypes.OrderType" var="orderForAn"
expressionBuilder="findByOrderId" scope="request">
<wcf:param name="accessProfile" value="IBM_Details" />
<wcf:param name="orderId" value="${WCParam.orderId}" />
</wcf:getData>
<%
java.util.HashMap map = new java.util.HashMap();
com.ibm.commerce.order.facade.datatypes.OrderType
ord = (com.ibm.commerce.order.facade.datatypes.OrderType) pageContext.getAttribute
("orderForAn",PageContext.REQUEST_SCOPE);
java.util.List orderItemList = ord.getOrderItem();
java.util.Iterator itr = orderItemList.iterator();
int i = 1;
while (itr.hasNext()) {
com.ibm.commerce.order.facade.datatypes.OrderItemType
orderItemObj = (com.ibm.commerce.order.facade.datatypes.OrderItemType) itr.next();
String id = orderItemObj.getOrderItemIdentifier().getUniqueID();
map.put(id, "null," + "attr" + i+ ".0-_-attr" + i+ ".1");
i++;
}
pageContext.setAttribute("eMap",map);
%>
<cm:order orderType="${orderForAn}" extraparmsMap="${eMap}" />
The previous sample code generates the following example cmCreateShopAction9Tag
output
for two catalog entries in the order: "Flavour-Fantasy Gift Set" and
the "Rolling Pin":
cmCreateShopAction9Tag ("KICO-02", "Flavour-Fantasy Gift Set",
"1.0", "43.58", "1502", "15501", "51.51", "10025", null, "attr1.0-_-attr1.1")
cmCreateShopAction9Tag ("KIAC-03", "Rolling Pin",
"1.0", "7.93", "1502", "15501", "51.51", "10025", null, "attr2.0-_-attr2.1")
cmCreateShopAction9Tag
output examples,
the extraparmsMap
parameter generated the following
data:- For the "Flavour-Fantasy Gift Set":
null, "attr1.0-_-attr1.1"
- For the "Rolling Pin":
null, "attr2.0-_-attr2.1"
extraparms
values,
see:Example of orderExtraparms
parameter
usage
The following shows an example of how you might include
a WebSphere Commerce analytics tag with the orderExtraparms
parameter
in a store page: <cm:order orderType="${orderForAn}" orderExtraparms="attr1-_-attr2" />
The
previous sample code generates the following cmCreateOrderTag
data
tag (note that the <order />
tag also generates
the cmCreateShopAction9Tag
data tag, but it is not
shown in this example):
cmCreateOrderTag ("16002", "46.65", "6.93", "1502", "LA", "CA", "11111",
"attr1-_-attr2", "-_--_--_--_--_--_--_--_--_--_--_--_-
Save 10% on all orders today|Flat Shipping-_--5.4|-1.93-_-|")
In
the previous cmCreateOrderTag
output example, the orderExtraparms
parameter
generated the following data about the order:
"attr1-_-attr2"