If I click on a link in a node, I want to know which Rules Event in Rules gets triggered that I can use.


  • On the home page, there are a lot of views blocks. So in that node title (or image or whatever is being clicked), in that link, I want to use some Rules Event.
  • I want to know if I click on that link, which event in Rules can be used in order to invoke. I tried Rules Event Content is viewed, but it didn't work.
  • is that link a field ? Pls specify which link
    – harshal
    Nov 22, 2013 at 8:07
  • In home page, there are lot of views block, so in that node title, or image or wat ever is being clicked, in that link, i want to call an event by rules?
    – Ram
    Nov 22, 2013 at 8:45
  • I want to know if i click on tat link which event in rules can be used in order to invoke. I tried content is viewed event in rules, but it didnt work.
    – Ram
    Nov 22, 2013 at 8:54

2 Answers 2


Whatever you want to happen via Rules module when some link is clicked, if you're using Rules Event 'Content is viewed', you'll probably be too late:

  • the content (or whatever the clicked link is about) is already being shown, so if the Rules Conditions are satisfied, the Rules Actions will be performed. That is what 'Content is viewed' is all about.
  • if you didn't want to content (or whatever the clicked link is about) to be visible at all, well sorry, but you're too late.

If however you did want something to happen BEFORE showing the content (or whatever the clicked link leads to), then you should use Rules Event 'Drupal is initializing'. Refer to 'How to specify a Rules event like "Content is 'going to be' viewed"?' for way more details on this.

Attention: Rules Event 'Drupal is initializing' gets triggered on every (repeat: every) page load in a Drupal site. So for performance reasons, you really want to limit the number of active Rules that use this Rules Event to an absolute minimum, i.e. as your last resort (if anything else fails).


Rules are invoked on the server side...links are clicked on the client side. There's a gap there that you'll need to bridge.

Two options come to mind

  1. Fire your events based on the path that the link resolves to. This will obviously fire the event whenever the URL is visited, not necessarily just when it's been clicked through from your site.
  2. Write some JS that sends an AJAX request to a custom path, and have the callback for that path invoke the event. Attach that JS to the click event handler for the links you want to track. This is probably your only option if you need to respond to a click, rather than just a certain path being visited.
  • The Link url that i constructing is through Views-view-field--title.tpl.php. How can i pass ajax while clicking on that link? @clive
    – Ram
    Nov 25, 2013 at 4:59
  • I want to the get user who is logged in that site, to be automatically logged in , when they click on the link which will open in the new tab.All opening in new tab is ready, only thing is how i set the user on clicked link.
    – Ram
    Nov 25, 2013 at 5:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.