views:

161

answers:

6

I have built a web application using Java EE platform that sells one of my software.

Now I want to give the work of marketing my website to various e-marketing companies. But as I will have to give the commission to them, I should know that who sends the traffic.

I think that one solution to above problem is:

Make a separate URL for each e-marketing company and give them their corresponding URL and redirect all those URLs to a single Servlet. And after that, count the no. of visitors on a particular URL (url of an e-marketing company) to count the no. of visitors referred by that e-marketing company.

The Google and various other use similar kinds of techniques which distinguishes one from other.

Q1. Do all of them uses this kind of approach?

Q2. Is there any other approach by which this can be done in a much better way?

You can also advice some other things too...

Thanks in advance

A: 

Pretty much similar to the previous answer - you can give each affiliate web site a unique key (in the URL) that they would submit. your server application will (decipher and) match the key against a list of affiliate web sites and count the leads origin.

krassib
+1  A: 

afaik, there are 3 possibilities:

  1. as you mentioned, unique url for each company,
  2. using a "coupon code" that needs to be entered by visiting user. a bit annoying for the visitor, but i've seen something like this.
  3. last, only work if the companies you mentioned have a website and putting link to your site from there: by capturing the referer url

the best, in my opinion, is the first option. which is probably why this is the most widely used/know.

you'd probably want to implement cookie to "remember" that a visitor coming from which company, so when a visitor --who haven't decide to purchase anything on first visit-- returns and buy something, you will know which company introduce your site to them.

widyakumara
+2  A: 

You could use a Query String parameter, too. (This may be what krassib was referring to.) Like http://yoursite.foo/yourpage.jsp?affiliateid=ABC123

Then just have that single page parse the querystring from the URL and store/count that.

TomR
+1  A: 

Yep i agree with @krassib and @TomR - use a queryString parameter, then you can write a servlet filter to check for the specific paramater and increment the count for that affiliate. Using a servlet filter would also give you the added bonus of being to track the count of individual links on a per affiliate basis.

You do something like the following:

import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

public class AffiliateTrackingFilter implements Filter{

private AffiliateTrackingService affiliateTrackingService = null;

@Override
public void destroy() {

}

@Override
public void doFilter(ServletRequest rq, ServletResponse rs, FilterChain chain) throws IOException, ServletException {
    String affililateId = rq.getParameter("affiliateId");
    affiliateTrackingService.incrementAffiliateHit(affililateId);
    chain.doFilter();
}

@Override
public void init(FilterConfig fc) throws ServletException {
    affiliateTrackingService = new AffiliateTrackingService();
}

}

Then add something like this to your web.xml

<filter>
    <filter-name>AffiliateTrackingFilter</filter-name>
    <filter-class>com.example.AffiliateTrackingFilter</filter-class>
</filter>

<filter-mapping>
    <filter-name>AffiliateTrackingFilter</filter-name>
    <servlet-name>MyMainServlet</servlet-name>
</filter-mapping>

And have a filter mapping for all of your servlets.

simonlord
@simonlord Some requests those come from search engine won't contain affiliate id. So what would be the solution for that?
Yatendra Goel
@Yatendra: Requests from search engines should not be associated with an affiliate, since the affiliate was not responsible for driving traffic to your site. That is, they don't need to contain an affiliate ID, since they didn't come from an affiliate.
Software Monkey
@Software Monkey .. I know this that's why I asked the above question... actually you interpreted it wrong or may be I couldn't explain it clearly... Now i have got my answer from someone else.. but thanks for spending your time in answering
Yatendra Goel
A: 

Hi Yatendra.

Why not using what's already there? I'm talking about the HTTP protocol and one of its header fields: Referrer (typically passed to code in the environment variable HTTP_REFERER or HTTP_REFERRER).

Though it's not 100% bullet proof (but then again, what's a 100% bullet proof?) I think it could be sufficient in your case. I assume that customers of yours which are associated with an affiliate are reffered from one of their sites? If so, it would be easy for you to distinguish between customers coming from different e-marketing companies as each of them should have their own domain name.

Read more about the Referrer field. Keep in mind though that referrer spoofing or hiding is possible but very very unlikely (going over my server logfiles it's an estimated 95% of all my visitors that do send the referrer field).

Regards.

aefxx
I can't use Referrer field as I am not going to restrict e-marketing companies to have their own website (though in most cases they do have). This way, they can also put banner ads of my site to other sites.
Yatendra Goel
+1  A: 

Ok, here's another one. You could use the anchor method. Let me explain:

Imagine that http://myappz.com/fooshop_cs is the selling product's URL and this is what you distribute to your affiliates but each with a small variation. You simply add a unique ID to the URL by hijacking the fragment identifier (i.e. http://myappz.com/fooshop_cs#em001).

Once a user follows a link to your site that has been charged with a unique ID, you check for the IDs existence using Javascript (location.href.search(/#em\d*/)). Once you found an ID you simply trigger an AJAX call to take that affiliate up a notch (I may recommend the jQuery framework to do so).

The benefit of this approach is that search engines don't care about fragment identifiers and that you will be able to sell your product from a single page. Your users won't care either as the anchor has absolutely no impact on them (except you would setup an anchor tag within your page).

bye

aefxx