Using the campaign tag with IBM Digital Analytics

If your site is integrated with IBM Digital Analytics, you can use the default implementation of the <cm:campurl /> tag that WebSphere Commerce provides. The campaign tag tracks impressions and clickthroughs for web and email marketing activities.

Unlike other WebSphere Commerce provided tags, such as <cm:pageview /> and <cm:order />, the campaign tag does not generate a IBM Digital Analytics data tag. Instead, the campaign tag takes the URL of the web or email activity as input. The tag then modifies the URL by appending data about the activity to the URL by using specific IBM Digital Analytics tracking parameters. The modified URL is stored in the campaign tag's id parameter and used as the link to marketing content, making the data available to IBM Digital Analytics. The IBM Digital Analytics tracking parameters that the campaign tag appends to the modified URL are different, depending on the type of marketing activity:
cm_cr
Tracking parameter that is used for both web and email activities. Using the cm_cr parameter, the campaign tag provides five pieces of data, delimited by the value "-_-":
  • Campaign name, if the activity is associated with a campaign
  • Marketing activity type (either Web+Activity or Email+Activity)
  • Marketing activity name
  • e-Marketing Spot name (for web activities), or email template name (for email activities).
  • One of the following, whichever applies:
    • Name of the marketing content that is displayed in the e-Marketing Spot (catalog entry name, category name, or content name).
    • Name of the link that is inserted in the email template. The link name is specified in the Management Center email template properties.
cm_mmc
Tracking parameter that is used only for email activities, in addition to the cm_cr parameter. Using the cm_mmc parameter, the campaign tag provides four pieces of data, delimited by the value "-_-":
  • The value Email
  • The value WebSphereCommerce
  • Email activity name
  • One of the following, whichever applies:
    • Name of the marketing content that is displayed in the e-Marketing Spot (catalog entry name, category name, or content name).
    • Name of the link that is inserted in the email template. The link name is specified in the Management Center email template properties.
cm_me
Tracking parameter that is used instead of the cm_cr parameter if the web activity is a marketing experiment. Using the cm_me parameter, the campaign tag provides three pieces of data, delimited by the value "-_-":
  • Marketing activity name (experiment name)
  • Whether the marketing content displayed is the control or the test element in the experiment
  • Name of the marketing content displayed (catalog entry, category, or content)

The following example shows the original URL for an e-Marketing Spot, and the modified URL with the cm_cr parameter appended:

Original URL for a web activity

http://localhost/webapp/wcs/stores/servlet/Category5_10101_10101_10102_-1_Y_10102_image_0
Modified URL for a web activity with appended cm_cr parameter values

http://localhost/webapp/wcs/stores/servlet/Category5_10101_10101_10102_-1_Y_10102_image_0
?cm_cr=Red+Tag+Deals-_-Web+Activity-_-Home+page+category+recommendations-_-HomePageRow2Ads-_-Tableware

Tag placement in store pages

Include the <cm:campurl /> tag in all e-Marketing Spot JSP files, before the logic that displays the marketing content. The following example shows where to place the campaign tag in relation to the e-Marketing Spot code; the <cm:campurl /> tag is shown in bold text:


...
<%-- Coremetrics tag --%>
<flow:ifEnabled feature="Analytics">
    
   <cm:campurl espotData="${marketingSpotDatas}" id="ClickInfoURL" url="${ClickInfoURL}"
          initiative="${marketingSpotData.activityIdentifier.uniqueID}"
          name="${marketingSpotData.marketingContent.marketingContentDescription[0].marketingText}"/>


</flow:ifEnabled>

...
<%--
*
* Display the content image, with optional click information.
*
--%>
<c:if test="${!empty marketingSpotData.marketingContent.url}">
	<a id="WC_ContentAreaESpot_links_3_<c:out value='${status3.count}'/>" href="${absoluteUrl}${ClickInfoURL}" ${clickOpenBrowser} >
</c:if>
	    <img src='<c:out value="${hostPath}${staticAssetContextRoot}
       /${attachment.attachmentAsset[assetIndex].rootDirectory}
       /${attachment.attachmentAsset[assetIndex].attachmentAssetPath}"/>
       'alt='<c:out value="${attachment.attachmentDescription[descriptionIndex].shortDescription}"/>
       ' border="0" />
<c:if test="${!empty marketingSpotData.marketingContent.url}">
   </a>
</c:if>
To setup the URL for the <cm:campurl /> tag for marketing content, refer to the following code snippet:
<%--
     *
     * Set up the URL to call when the image or text is clicked.
     *
   --%>
           <c:set var="contentClickUrl" value="${param.contentClickUrl}"/>
           <c:if test = "${empty contentClickUrl}">
                    <c:url value="${marketingSpotData.marketingContent.url}" var="contentClickUrl">
                            <c:if test="${!empty param.errorViewName}" >
                                    <c:param name="errorViewName" value="${param.errorViewName}" />
                                    <c:if test="${!empty param.orderId}">
                                            <c:param name="orderId" value="${param.orderId}"/>
                                    </c:if>
                            </c:if>
                    </c:url>
           </c:if>

<c:url value="${clickInfoCommand}" var="ClickInfoURL">
    <c:param name="evtype" value="CpgnClick" />
    <c:param name="mpe_id" value="${marketingSpotDatas.marketingSpotIdentifier.uniqueID}" />
    <c:param name="intv_id" value="${marketingSpotData.activityIdentifier.uniqueID}" />
    <c:param name="storeId" value="${storeId}" />
    <c:param name="catalogId" value="${catalogId}" />
    <c:param name="langId" value="${langId}" />
    <c:forEach var="expResult" items="${marketingSpotData.experimentResult}" begin="0" end="0">
             <c:param name="experimentId" value="${expResult.experiment.uniqueID}" />
             <c:param name="testElementId" value="${expResult.testElement.uniqueID}" />
             <c:param name="expDataType" value="${marketingSpotData.dataType}" />
             <c:param name="expDataUniqueID" value="${marketingSpotData.uniqueID}" />
    </c:forEach>
    <c:param name="URL" value="${contentClickUrl}" />
</c:url>

You must also include the tag library in the JSP page before the main page content by using the following code:


<%@ taglib uri="http://commerce.ibm.com/coremetrics" prefix="cm" %>

Examples of campaign tag usage

To send data about impressions and clickthroughs for web and email activities to IBM Digital Analytics:

Include tag in your store page like this: If your store uses data beans and URL commands for marketing runtime functions, use the databean parameter:
<cm:campurl databean="${eMarketingSpot}" id="ClickInfoURL"
      url="${ClickInfoURL}" 
      initiative="${catEntry.initiativeId}"
      name="${catEntry.description.name}" />

If your store uses web services for marketing runtime functions, use the eSpotData parameter:

<cm:campurl espotData="${marketingSpotData}" id="ClickInfoURL"
      url="${ClickInfoURL}" 
      initiative="${catEntry.initiativeId}"
      name="${catEntry.description.name}" />