Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display Shepherd only during first visit #164

Closed
sSwiergosz opened this issue May 28, 2017 · 8 comments
Closed

Display Shepherd only during first visit #164

sSwiergosz opened this issue May 28, 2017 · 8 comments

Comments

@sSwiergosz
Copy link

Hi! How to make Shepherd display tour only during the first visit on the site or until the user press close button?

@pmocal
Copy link

pmocal commented May 30, 2017

use localStorage to record the most recent visit and encase tour deployment in if-else conditional that checks contents of localStorage

@sSwiergosz
Copy link
Author

But when user changes browser or device it won't work...

@Brikky
Copy link

Brikky commented Jun 5, 2017

Set a boolean value on the user to check if they're a new user or not.

@ysrinivasreddy
Copy link

use parameters in url
www.example.com/?tour

Javascript

$(function() {
    if ( document.location.href.indexOf('?tour') > -1 ) { 
         tour.start();
    }
});

java code to load Scripts

<c:if test="${param['tour'] ne null }"> 
<script src="shepherd/tether.js"></script>
<script src="shepherd/shepherd.min.js"></script>  
<script src="shepherd/tutorial.js"></script>  
</c:if> 

@RobbieTheWagner
Copy link
Member

This is a concern of your application. You must store a value to keep the tour from showing up again.

@yonkov
Copy link

yonkov commented Apr 29, 2021

In case anyone needs more information on how to show the tour only one time, I wrote a short guide about how I implemented it in my app. I am using localStorage, as suggested by @pmocal, and I am also adding additional checks if the user has finished or dismissed the tour : How to Display Shepherd.js Only Once

@RobbieTheWagner
Copy link
Member

Thanks @yonkov! Please feel free to add some of these things to the official docs in the cookbook, if you'd like.

@benhbell
Copy link

I just used this logic 4 years later in my product onboarding. THANK YOU.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants