utilitees

- Addons for ExpressionEngine 1.7.x

AJAX Linktracker Documentation

Download Download

Installation:

  1. Upload the file linktracker.js anywhere to your site and remember the URL.
  2. Upload the folder named linktracker and its content into the modules-folder of your EE system-directory.
  3. Upload the file named lang.linktracker.php into the /language/english-folder of your EE system-directory.
  4. In your Control Panel navigate to CP Home ›  Modules, find the AJAX Linktracker module and click Install.
  5. Now you have access to the CP Interface of the module. It is here where you can view and reset the click-statistics.
Back to top

Adding the javascript-snippet to your templates

On every page that may contain links that are to be tracked the java-script call needs to be included. Preferably somewhere at the bottom of the page. If you have a footer-template that may be a good place to put it.

Add the following code to the template/s in question:

<script type="text/javascript" src="http://yourdom.ain/linktracker.js"></script>
<script type="text/javascript">
{exp:linktracker:apiurl}
</script> 

Of course you need to replace the URL to the one where you uploaded your copy of linktracker.js.

Back to top

Usage:

Now all you got to do is to add a unique id-attribute to any link that is supposed to be tracked. This may be links in entries as well as links you compose somehow in your templates with custom fields and the like. External links, internal links, links to files… it doesn’t matter as long as it has and id.

Example:

<a id="holiday-photos" href="http://mydom.ain/pictures.zip">My latest album</a

This link will show up under the Link ID holiday-photos in the click-statistics.


<a href="http://expressionengine.com/">Great CMS</a

This link will not be tracked since there’s no id present.

Back to top

Special IDs

There is a set of IDs that serve a special purpose. If the id starts with either vc1_, vc2_, vc3_ or vc4_ followed by a number it is assumed that the number is an entry_id of a weblog entry.

If a link with such an id is clicked it gets tracked like usual. Additionally the corresponding view_count variable of the weblog entry is incremented by one.

Example:

<a id="vc2_93" href="http://anydom.ain/blog.php"></a

If this is clicked, view_count_two of the weblog-entry with the entry_id 93 gets incremented.

<a id="vc4_115" href="http://another.dom.ain/index.html"></a

If this is clicked, view_count_four of the weblog-entry with the entry_id 115 gets incremented.

I think you get the point.

An application example for this is a link directory-type of site where you have a custom field for an outgoing URL. In a template you’d do something like:

{exp:weblog:entries weblog="directory"}
<h2>{title}</h2>
{site_description}
<a id="vc1_{entry_id}" href="{sites_home}">Goto Homepage</a> (Visited {view_count_one} times)
{/exp:weblog:entries} 

Then you could use

{exp:weblog:entries weblog="directory" orderby="view_count_one" sort="desc"


to easily pull out a list of the most popular links in your directory.

Back to top

Display # of clicks in templates

There’s also a tag that outputs the number of clicks for a given link_id if you don’t utilize the view_count approach. It’s a single tag that doesn’t have a closing element.

{exp:linktracker:clicks link_id="holiday-photos"

It only has one mandatory parameter which is the link_id=”“ to be displayed.

Back to top

Click Statistics:

Under CP Home ›  Modules ›  AJAX Linktracker you’ll find a list of all Link IDs and their number of clicks. They only show up once they have been clicked for the first time.
To the right there is a Reset-link on every line that resets the counter for the respective Link ID.
If you click on a Link ID you get a detailed listing of every click for that ID.

Back to top

Questions / bug reports

For general comments, brickbats & bouquets please use the form over here.
Name:

Email:

URL:


Remember my personal information
Notify me of follow-up comments?


Page 2 of 3 pages  <  1 2 3 >

User Talk

Dave Macli:
2010-01-27 17:28

Hello,

It seems like the link tracker breaks if there is a special character in the URL, anchor text or the Title of the link.  Is there any way to resolve this?



Rob B:
2009-12-20 01:29

Hey Oliver. I mysteriously was able to get it to work. I just went back and tried to link ordinary text links first, then image links, then image links brought in through a weblog call, then a weblog call in an embedded template, etc. etc.

I thought I’d be able to reproduce what was going wrong for you, but I couldn’t… I thought it had to do with alt tags missing from a linked image, but that seems to work now if you don’t include alt tags on the image.

Seems like it can handle anything! Anyway, I just flew you a donation. Thanks for the great work on LinkTracker!



Oliver:
2009-12-16 15:38

They don’t have to. But the {entry_id} must of course be in a context where it actually is replaced by the actual entry number.



Rob B:
2009-12-16 05:23

Hmmm… seem to have done everything correctly, module is installed, scripts are at the bottom of the page and their URL is correct, the links have an id like vc1_{entry_id} ... but no tracking joy of any kind when I go back to the module.

Does the link, by any chance, have to be on a entry detail page (at least when you use the view count variation?)



Ryan Hudson:
2009-11-16 05:02

so… worked it out all on my own.
If anyone is wanting to know, just add a conditional statement in the addclick constructor found in the mod.linktracker.php file.

under the line:
$ip = $IN->clean_input_data(base64_decode($IN->GBL(‘uip’, ‘GET’)));

just add:
if($ip == “ignored.ip.address”) {
  exit;
}



Ryan Hudson:
2009-11-16 03:53

also noticed that if you have a “(” or “)” in the link you are trying to track, it just won’t… for obvious reasons… but not so obvious for the hour I spent wondering why it wasn’t working for that one link! ;o)



Ryan Hudson:
2009-11-16 03:51

Love the module…
How would I go able ignoring clicks from a specific IP Address?



christian:
2009-10-19 15:26

Hi
Thanks for the module. Installed it as described, but id link would not come in cp of module. how does the cp of the module looks like?



Oliver:
2009-06-21 16:17

Have you uploaded the files in ASCII mode?
I was not able to reproduce any problems.



Andrew:
2009-06-21 15:52

I can confirm this module when uploaded as per the default files, with GZip on, causes a fatal error.