There will be 5 steps here as below:
- Create a custom field in Marketo for Password
- Create a new form using Password Field
- Create 3 Landing Pages
- Create Program Tokens
So, let’s begin with the steps:
01. Create a custom field in Marketo for Password
We need to create a custom field in Marketo for the Password. It should be string type.
02. Create a new form using Password Field
Now, we will be creating a form which have the email address field and password field. We are not using email field anywhere it is just for storing the person’s data. If this page is visited from an email link, email address field can be hidden as Marketo will prefill the field based on token.
03. Create 3 Landing Pages
We will be creating three landing pages here. Login Page, Gated Page and Unauthorized Page.
04. Create Program Tokens
We will create 4 Program Tokens here. One for the Password and 3 for Landing Pages URL’s which we created in step 3.
Login Page JS
Gated Page JS
This code checks if the cookie exists on the browser, if not, it will redirect the person back to login page. This code should be added at the top of page in <head> tag.