Counting Link Clicks With AJAX
Nov 16, 2005
I have been trying to think up a way to count the number of clicks a partner/affiliate link on my website recieves. Many websites use some tracking script but the partner/affiliate wont benefit from your PR and the link would be for traffic only. It bugs me when I request a link exchange and instead of getting the straight link that I give the other person, I get a link to a script that tracks the clicks. So with the help of AJAX, I was thinking of doing something like:
Code:
<a href="http://www.domain.com" onClick="trackClick(this)">Link text</a>
Where trackClick() is an AJAX function that sends the client information (IP, timestamp, link clicked, etc) to a PHP script which then stores it in a database. Seeing as search engine bots have JavaScript disabled, they would see the code as a straight link to another site and give the target website credit for the link.. while the webmaster can keep track of the number of clicks their links recieve.
My question is.. would this work? And has anyone tried implementing something like this before?
View 10 Replies
ADVERTISEMENT
Oct 25, 2010
I want to count the amount of divs on a page with the class of "samplesSection".
HTML
<html>
<head>
[code]....
When you click on "Click", it alerts you with how many divs with class "sampleSections" exist. Here's the problem: When it loads, just click "Click". It alerts 1 - valid. Then click "Category", AJAX refreshes, click "Click" and it alerts 2 - valid again. Click "Client", AJAX refreshes, and click alerts 3 - valid once more. However, whenever I click back on any of the other categories, it always alerts 3.
View 1 Replies
View Related
Jan 29, 2011
I have 16 links on a page, when each link is clicked, I need to change text that is on the page.
This is Page 1
link 1 This Is Page 1
link 2 This is Page 2
[code]....
View 5 Replies
View Related
Mar 18, 2011
I would like to change the text of an <a> element when the user clicks on it. The code that I've written is only "half" working:
Code:
$('#linkid').click(function() {
if ($('#linkid:contains("text1")')) {
$('#linkid').html('text2');
} else {
$('#linkid').html('text1');
}
Initially the text of the <a> element is "text1".
When I click on it the text is correctly changed to "text2". But if I click on it again, the text doesn't change back to "text1", it remains "text2".
View 5 Replies
View Related
Dec 7, 2010
I want to send a simple email with just email & subject only when the user clicks a link that opens a pdf. I'm thinking javascript is the best way to do this but I have no idea how. I have googled it a bunch but most information is about getting an email when someone clicks a link you send in an email. I don't want that. This is on a website. I'm not sure if php would be better to use.
View 7 Replies
View Related
Feb 10, 2011
I have created a slideshow before but I want to create a slideshow where a person clicks on a link and it goes to a certain picture which might have one or more links embedded into the picture something like this:
[URL]
View 5 Replies
View Related
May 18, 2009
how i can count the number of times a visitor clicks on a particular link on my site? can i use javascript?
View 4 Replies
View Related
Jan 9, 2009
I have this website that logs users clicks and their referrals clicks. I have graphs for each of these things. I currently have it working that when a user clicks a link on a page, it opens up another page and shows the graph. I want this to be sort of like a "drop down" window when they click. Here is a picture of when the link is not clicked: And when the blue circle (the thing boxed in red) is clicked:
View 4 Replies
View Related
Jul 20, 2005
a website opens in my iframe Is there a way to know the address of the
link the visitor clicks on?
View 2 Replies
View Related
Apr 23, 2009
I'm trying to open a div that holds several images when the user clicks on a link. Each clicked link will open the div and display a specific pic. Plus each time a link is clicked the div should close before opening the div with the appropriate pic. Since I'm new to jquery I'm a bit lost on this one.
[Code]...
View 1 Replies
View Related
May 29, 2011
I'm trying to set a cookie when a user clicks a hyper link.
Do you think I should prevent the default behavior of pressing a link first, and then set the cookie?
Or could I just set the cookie on a hyper link click event, and hope the client sets the cookie, before they are directed to another page.
View 3 Replies
View Related
Jan 12, 2010
I have installed a flash mp3 player that streams music while browsing my website. Unfortunately there is a problem that any time you click a link to another page, everything reloads and the music restarts. Looking for advice on how to implement the music stream so it plays continuously and not affected by changing pages of the site. I would like to avoid any sort of frames implementation. Only other thing I can think of is some sort of AJAX implementation
View 1 Replies
View Related
Apr 12, 2010
I've got a jQuery ajax call to a php script which gets aborted when a user clicks on any link on the page.
The ajax call aborts ok, but the php script, which includes a sleep() function is not aborted until after the sleep() has finished sleeping.
Does anyone know if there's any way to make the sleep() function also abort when a user cancels / aborts the ajax request?
View 10 Replies
View Related
Dec 2, 2011
I'm trying to set up a web page to display a video when a user clicks on a link. So far, it works fine in IE and Chrome, but it won't work in Firefox.[URL]
View 2 Replies
View Related
Mar 30, 2010
I'm having a bit of a problem with my javascript (ajax)... it seems that the first click is selecting the image that is suppose to invoke the ajax... and all subsequent clicks operate as expected ... changing the image and performing some operation on the database via php.
Here's my javascript:
Code:
function getXMLHttp() {
var xmlHttp;
try {
xmlHttp = new XMLHttpRequest();
[Code]....
The page is coded completely tableless in css... not sure if this matters. I've used the same type of ajax implementation on other sites without this problem... but have no idea what is causing it here....
View 1 Replies
View Related
Mar 19, 2011
When the user clicks the remove link it properly adds a new option to the dropdown however it adds it 3 times meaning 3 option tags. Why is that?
Code:
// Add a click handler to each anchor tag in the characterList <ul> element
$('#characterList a').click( function(evt) {
evt.preventDefault();[code].....
View 1 Replies
View Related
Apr 7, 2011
I've been reading about jquery and ajax and I'm not exactly 100% sure as to how to implement it. Essentially I have the following:
A textbox
A select box
Another select box
As the user fills data in the textbox and then clicks off I want the javascript to fire, submit the value in the textbox to a url (I can handle the backend side of it all fine) which will then send new data to the select boxes. Similarly for the second select box when a user clicks off (After selecting) I need the jquery to fire again. I've seen this code and think I get how to write it in, but I'm not sure how to do the (When user clicks off bit of it).
$.get('ajax/test.html', function(data) {
$('.result').html(data);
alert('Load was performed.');
});
View 1 Replies
View Related
May 5, 2010
When a user in somewhere of a site, he/she may want to login to access some user restrict pages. He/she clicks a login link on the menu and sign in on the login page. How to use JQuery to let the user back to the page where he/she clicks the login link?
View 3 Replies
View Related
Feb 22, 2011
How to show/hide several paragraphs when the user clicks next and then the reverse when the user clicks prev.
View 1 Replies
View Related
Apr 8, 2006
i want to make a section using javascript that may incoporate user input counters. for now i'm trying to make it so that if you type in a phrase or sentence in a textbox and a letter in another textbox, it will count how many letters are in the phrase. the point of this is i want to be able to categorize famous phrases by the number of specific letters they contain.
View 3 Replies
View Related
Mar 16, 2006
Is there a way to count files in a specific folder using ONLY
javascript?
I am creating a site for the intranet at work that will post weekly
reports. Users will drop weekly reports in a folder and I would,
hopefully, like to post whatever files are in that folder without
manually creating links to each file..
View 2 Replies
View Related
Apr 2, 2010
I've been fiddling with the .length function but can't get it to return anything other than the number of <img> in the document.
View 3 Replies
View Related
Sep 19, 2009
I have an array holding 100 randomly generated integers between 0-9 inclusive...firstArray[99]
how do i use a second array to keep count of how many times each integer is generated..secondArray[9]
View 2 Replies
View Related
Nov 22, 2006
Is it possible to count how many layers have been loaded as they are loading?
What I want to make is a layer containing the text "x of 15 layers loaded" and for x to increase everytime a layer is loaded on the page. (using onload?)
View 2 Replies
View Related
Sep 18, 2006
Does anyone know a simple way to count how many times a file is downloaded from my site - just Word Docs, Excel Docs etc. I say simple because I'm a Javascript toddler.
View 2 Replies
View Related
Dec 28, 2011
I can do this using Java, Vb.Net or C# .. Now, I am currently studying javascript but I don't know how to do this... I want a looping number, the number will start at 200 and it must end at 900, the loop format is like a.. from 200 it must increment but 1 every second and stop when it reach the 900, the counter must start when the page is loading or after loading.
View 2 Replies
View Related