Run different js on each user visit

Viewed 28

I want to load javascript functions on a wordpress site based on user visit, if it's the first time, then one function will run, if its second visit another code will run., I found that using cookies and local storage we can set it, but only track user if visited or not., I want to count the user visit, and based on that run the functions.

1 Answers

it is the same thing set a cookie for visiting if it is not set so it is the first visit so set it to 1 if it is 1 so second visit so set it to 2 if it is n so it is n + 1 visit so incrment n

Related