• 1
name Punditsdkoslkdosdkoskdo

display a specific page only the 1st time user visite our site

I am working on darskite project in case of crisis. For this project we want to prepare a specific case.

We need to inform the user visiting our website of the crisis (eg : our factory has an electrical failure). We want to show him this specific page of information only during the first time he comes in our website. For the next visits, he must visit our classical homepage.

How can we target and identify a user to redirect him only once to the alert message (when he first logs in)? Are there any solutions like those for retargeting Google or Facebook via cookies? If Yes, what kind of cookie ?

Our website is powered by Drupal 7. Can Drupal handle this case?

Thank you for your ideas.


From the drupal docs:!user!user.module/function/user_cookie_save/7.x

What you can do is: You first check if a cookie has been set. If not, then you set it. The next time the user visits your site, he/she will have a cookie so the logic gate will be passed.

Here's an example that you can use in your header file in drupal:

if (!isset($_COOKIE['some_descriptive_cookie_name'])) {
     drupal_goto('temp/page/here', [], 307);

drupal_goto is documented here:

Good luck.

  • 0
Reply Report