<%@ page import="java.lang.*" %> <%@ page import="java.net.*" %> <%@ page import="com.easyinsurance.common.DashBoard" %> <%@ page import="java.util.regex.*" %> <% //Setting cookie for paid campaign tracking String utm_campaign=request.getParameter("utm_campaign"); if(utm_campaign==null) utm_campaign=""; Pattern p = Pattern.compile("^[a-zA-z][a-zA-z0-9,_-]*"); Matcher m = p.matcher(utm_campaign.trim()); boolean matchFound = m.matches(); System.out.println("matchFound.."+matchFound); if(matchFound==true && utm_campaign.trim().length()>0){ //set cookies //check if cookie already set String cookieName = "easy_utm_campaign_val"; String cookieVal =""; Cookie cookies [] = request.getCookies (); Cookie easyCookie = null; if (cookies != null){ for (int i = 0; i < cookies.length; i++){ if (cookies [i].getName().equals (cookieName)){ easyCookie = cookies[i]; cookieVal=easyCookie.getValue(); break; } } } String newCookieVal=""; if(cookieVal!=null && cookieVal.trim().length()>0){ newCookieVal=cookieVal+","+utm_campaign; }else{ newCookieVal=utm_campaign; } Cookie cookie = new Cookie (cookieName,newCookieVal); cookie.setMaxAge(30 * 24 * 60 * 60); response.addCookie(cookie); } String text=""; try{ String rmhost= request.getRemoteHost(); String refname=request.getHeader("Referer"); String prod=request.getParameter("prod"); String mailcamp=request.getParameter("mailcamp"); URL url=new URL(refname); String dname=url.getHost(); if(dname != null && mailcamp != null && prod != null) dname=dname+"$- "+prod+"$-"+mailcamp; DashBoard dashobj=new DashBoard(); int kk=dashobj.getReferweb(rmhost,dname); if(prod.equals("travel")) response.sendRedirect("travelhome.do"); else if(prod.equals("health")) response.sendRedirect("healthHomeSearch.do"); else if(prod.equals("tw")) response.sendRedirect("twowheelerSearch.do"); else if(prod.equals("car")) response.sendRedirect("motorHomeSearch.do"); else if(prod.equals("home")) response.sendRedirect("searchhomeinsurance.do"); else if(prod.equals("life")) response.sendRedirect("lifeHomeSearch.do"); else if(prod.equals("pa")) response.sendRedirect("personalAccidentInsurance.do"); else response.sendRedirect("customerIndex.do"); }catch(Exception e){ response.sendRedirect("customerIndex.do"); } %>