Isn’t it iconic? by Mykl Roventine
Convenience
eCommerce sites want to make their users’ experience as convenient and intuitive as possible. One convenience found on most major eCommerce sites is remembering what the user put in his shopping cart, even if that person didn’t log in. Therefore when the user returns to the site he will see what he left in his shopping cart.
Persistent Cart
ATG makes it relatively simple to do this by:
- creating a profile in the repository (database) for all users that visit the website
- automatically logging in users by cookie
Therefore if a user returns, she/he will be automatically logged in and if there were any items in his cart they will be added to the current cart.
Implementation
- Turn on persisting anonymous profiles in the ProfileRequestServlet.
[ruby]# /atg/dynamo/servlet/dafpipeline/ProfileRequestServlet
persistAfterLogout=true
persistentAnonymousProfiles=true[/ruby]
- Turn on auto-login by cookie and turn off auto-login by basic authentication.
[ruby]# /atg/userprofiling/CookieManager
sendProfileCookies=true
# /atg/userprofiling/ProfileRequestServlet
verifyBasicAuthentication=false[/ruby]
- Make all profile properties not required except for login and password in userProfile.xml. Also make autoLogin true.
[xml]<table name="dps_user">
<property name="login" required="true" />
<property name="password" required="true" />
<property name="firstName" required="false" />
<property name="lastName" required="false" />
<property name="email" required="false" />
<property name="autoLogin" default="true" />
</table>[/xml]
Notes
When a profile is created for an anonymous user the login and password are set to the user’s ID (i.e. the profile’s repository ID).
If you are adding this functionality to an existing up and running site you may have to modify your user tables so that there no “not null†columns except for the id, login and password columns, you can leave those as how they were. Also you will need to set auto_login to true for all your existing users.
update dps_user set auto_login = 1;
To determine when the anonymous user was created look at the registrationDate profile property. To determine when was the last time the anonymous user logged in look at the lastActivity profile property. Both of these are updated by ATG’s TrackActivity scenario which is in the DSS folder.
Finally do not turn on persistent anonymous profiles in the BCC. It will stop working if you do that.
For further reading please see Tracking Guest Users and Tracking Registered Users in the ATG 9.1 Personalization Programming Guide.