Suppose we have a page with the following structure:
<li id="A">
<span class="some class">some content
<a href="http://www.example.com">http://www.example.com</a>
</span>
</li>
<li id="B">
<span class="some class">some content
<a href="http://www.example.com">http://www.example.com</a>
</span>
</li>
<li id="C">
<span class="some class">some content
<a href="http://www.example.com">http://www.example.com</a>
</span>
</li>
Is it possible, with PHP or JS, to grab the list id (A,B,C) and append it along with the referring URL when a person clicks on any one of the three links?
- Need to know specifically which one of the three list tags the click originated from
- I don’t have write access to the originating page
UPDATE
In light of your revelation that you have no access to the original page, you’ve got no chance of finding out anything about the specific link that was clicked to arrive at your page. You can get the referrer with
document.referrer.Previous answer for posterity
The following function will capture a click on any link within the container element with the specified id and add a query string containing the id of the container element and the URL of the current page to the URL: