ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Any ideas how to quickly write to EE (via Safecracker?) when a link is clicked?

June 04, 2012 9:44am

Subscribe [2]
  • #1 / Jun 04, 2012 9:44am

    Dave Joyce

    49 posts

    I’m working on a web app with EE and Safecracker and one of the things I have is a list of links that my users have created for their favorite websites in the form of a grid. What I’d like to do is when they click on one of the links (taking them away from the site). Before they leave, I want to record somewhere that they clicked that specific link and +1 it’s value (and the date they clicked it). So what would happen is that they would get a “heat map” of sorts where their most frequented links would get hot and the less frequented links would cool down. And over time if a hot link isn’t visited in a while it starts to cool down.

    The thing is, if the link is serving to take them away from the site. How can I quickly record the click on that link before they leave. It’d have to be a super quick javascript of some sort - and very reliable. Right now I’m using safecracker to write to EE, but I worry that doing an AJAX write to EE with safecracker before the link click is activated would take too long? Just wondering if anybody has any ideas.

    Thanks!

  • #2 / Jun 04, 2012 10:26pm

    eevolution

    30 posts

    You could consider some custom coding with the built in API. I’ve used this a few times and its a great way to add/edit entry data without the use of the forms.

    http://ellislab.com/expressionengine/user-guide/development/api/api_channel_entries.html

    Simply add this to a template carrying the outside URL through POST/GET and then redirect at the end to this location.

    Tim
    http://www.eevolution.co.uk

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases