Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6869969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:37:29+00:00 2026-05-27T03:37:29+00:00

I have a website and I am user of several Affiliate Programs. How can

  • 0

I have a website and I am user of several Affiliate Programs.

How can I track which ones of the banners are being clicked by my visitors?

My website has basically two types of advertisement:

  1. Images with links
  2. Banners provided by the affiliate programs (usually it is an empty div, with a JavaScript code to retrieve the banner on demand on the Affiliate Program’s server)

So I had the idea to put every advertisement block of my website inside DIVs that have a given class, so every time the user clicks on one of the children, I can make a request to acknowledge this click on my Database (Note that this part is not explicit on the code). But this is not working. Probably due to a false jQuery selector usage.

Out of curiosity: Is there any plug-in for this usage?

CODE

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<script language="javascript" type="text/javascript">
    $(document).ready(function() {
        $(".ad").children().live("click", function(event) {
            var id = $(this).attr("id");
            alert(id); //should alert ad-1 or ad-2
        });
        $(".ad-affiliate").children().live("click", function(event) {
            var container = $(this).find(".affiliate-container");
            var id = container.attr("id");
            alert(id); //should alert affiliate-1
        });
    });
</script>
</head>
<body>
    <div class="ad">
        <a target="_blank" href="#">
            <img id="ad-1" src="src1.png"/>
        </a>
        <a target="_blank" href="#">
            <img id="ad-1" src="src1.png"/>
        </a>
    </div>
    <div class="ad-affiliate">
        <div id="affiliate-1" class="affiliate-container">
            <!-- THIS CONTENT IS GIVEN BY THE CODE PROVIDED BY THE AFFILIATE PROGRAM -->
            <!-- It is usually a div with a JavaScript code that populates the div with the content -->
        </div>
    </div>
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T03:37:30+00:00Added an answer on May 27, 2026 at 3:37 am

    Try this:

    $(document).ready(function() {
        $(".ad").on("click", "a", function(event) {
            var id = $(this).find('img').attr("id");
            alert(id); //should alert ad-1 or ad-2
        });
        $(".ad-affiliate").on("click", "a", function(event) {
            var container = $(this).closest(".affiliate-container");
            var id = container.attr("id");
            alert(id); //should alert affiliate-1
        });
    });
    

    Example here: http://jsfiddle.net/eLUQd/2/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing a website that requires several user types. I have been able
We have a website wherein a user can post information from our website to
Okay, so I have a website where the user can put a search query
I have aspx website in which I have multiple user controls. I want to
I have a website and when the user logs in they can click on
I have this website (C#/ASP.NET) with a form where the user can register for
I have a website on which I implement infinite scroll: when a user reaches
I have a real estate website that has several categories. And i want the
I have a ASP.NET website in which a user makes a request. Every request
I have a php-apache website on which I am trying to track download conversions

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.