Sample Web Connector Page
As an example, a file called testPage.html has been included with the Interact Web Connector that demonstrates how many of the features of the Web Connector would be tagged in a page. For convenience, that sample page is also shown here.
Sample Web Connector HTML Page
<?xml version="1.0" encoding="us-ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
<meta http-equiv="CACHE-CONTROL" content="NO-CACHE" />
<script language="javascript" type="text/javascript">
//<![CDATA[
/* ###################################################################
This is a test page that contains the WebConnector pageTag. Because the
name of this file has TestPage embedded, the WebConnector will detect a URL
pattern match to the url pattern "testpage" in the default version of the
jsconnector.xml - the configuration definition mapped to that "testpage"
URL pattern will apply here. That means there should this page the
corresponding html element ids that correspond to the IPs for this URL
pattern (ie. 'welcomebanner', 'crosssellcarousel', and 'textservicemessage')
####################################################################### */

/* ####################################################################
This section sets the cookies for sessionId and visitorId.
Note that in a real production website, this is done most likely by the login
component. For the sake of testing, it's done here... the name of the cookie
has to match what's configured in the jsconnector xml.
######################################################################## */
function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}
setCookie("SessionID","123");
setCookie("CustomerID","1");

/* #######################################################
Now set up the html element IDs that correspond to the IPs
####################################################### */
document.writeln("<div id='welcomebanner'> This should change, "
+ "otherwise something is wrong <\/div>");
document.writeln("<div id='crosssellcarousel'> This should change, "
+ "otherwise something is wrong <\/div>");
document.writeln("<div id='textservicemessage'> This should change, "
+ "otherwise something is wrong <\/div>");
//]]&gt;
</script><!--
###############################################################################
this is what is pasted from the pageTag.txt file in the conf directory of
the WebConnector installation... the var unicaWebConnectorBaseURL needs to be
tweaked to conform to your local WebConnector environment
###############################################################################
-->
<!-- BEGIN: Unica Interact Web Connector Page Tag -->
<!-- Copyright 2011, IBM Corporation All rights reserved. -->
<script language="javascript" type="text/javascript">
//<![CDATA[
var unicaWebConnectorBaseURL = "http://localhost:7001/interact/pageTag";
var unicaURLData = "ok=Y";
try {
unicaURLData += "&url=" + escape(location.href)
} catch (err) {}
try {
unicaURLData += "&title=" + escape(document.title)
} catch (err) {}
try {
unicaURLData += "&referrer=" + escape(document.referrer)
} catch (err) {}
try {
unicaURLData += "&cookie=" + escape(document.cookie)
} catch (err) {}
try {
unicaURLData += "&browser=" + escape(navigator.userAgent)
} catch (err) {}
try {
unicaURLData += "&screensize=" +
escape(screen.width + "x" + screen.height)
} catch (err) {}
try {
if (affiliateSitesForUnicaTag) {
var unica_asv = "";
document.write("<style id=\"unica_asht1\" type=\"text/css\"> "
+ "p#unica_ashtp a {border:1px #000000 solid; height:100px "
+ "!important;width:100px "
+ "!important; display:block !important; overflow:hidden "
+ "!important;} p#unica_ashtp a:visited {height:999px !important;"
+ "width:999px !important;} <\/style>");
var unica_ase = document.getElementById("unica_asht1");
for (var unica_as in affiliateSitesForUnicaTag) {
var unica_asArr = affiliateSitesForUnicaTag[unica_as];
var unica_ashbv = false;
for (var unica_asIndex = 0; unica_asIndex <
unica_asArr.length && unica_ashbv == false;
unica_asIndex++)
{
var unica_asURL = unica_asArr[unica_asIndex];
document.write("<p id=\"unica_ashtp\" style=\"position:absolute; "
+ "top:0;left:-10000px;height:20px;width:20px;overflow:hidden; \
margin:0;padding:0;visibility:visible;\"> \
<a href=\"" + unica_asURL + "\">" + unica_as + "&nbsp;<\/a><\/p>");
var unica_ae = document.getElementById("unica_ashtp").childNodes[0];
if (unica_ae.currentStyle) {
if (parseFloat(unica_ae.currentStyle["width"]) > 900)
unica_ashbv = true
} else if (window.getComputedStyle) {
if (parseFloat(document.defaultView.getComputedStyle
(unica_ae, null).getPropertyValue("width")) > 900)
unica_ashbv = true
}
unica_ae.parentNode.parentNode.removeChild(unica_ae.parentNode)
}
if (unica_ashbv == true) {
unica_asv += (unica_asv == "" ? "" : ";") + unica_as
}
}
unica_ase.parentNode.removeChild(unica_ase);
unicaURLData += "&affiliates=" + escape(unica_asv)
}
} catch (err) {}
document.write("<script language='javascript' "
+ " type='text/javascript' src='" + unicaWebConnectorBaseURL + "?"
+ unicaURLData + "'><\/script>");
//]]&gt;
</script>
<style type="text/css">
/*<![CDATA[*/
.unicainteractoffer {display:none !important;}
/*]]&gt;*/
</style>
<title>Sample Interact Web Connector Page</title>
</head>
<body>
<!-- END: Unica Interact Web Connector Page Tag -->
<!--
##############################################################################
end of pageTag paste
##############################################################################
-->
</body>
</html>