All Tutorials  >

Bootstrap Privacy Page

Learning Goals

At the end of this Tutorial you will be able to:

You can view the sample web page you will work with in this Tutorial by clicking the image or text link below. The finished sample will open in a new tab of your web browser.

sample image bootstrap-privacy-template.html


This sample privacy web page is suitable for including on websites that use Google Analytics.

Contents

About cookie privacy ‘pop-up’ messages

Downloading your sample privacy web page

Generate the Privacy Pop-up Message

Adding the CSS link and JavaScript code to your privacy web page

Uploading your Bootstrap folder to GitHub

About cookie privacy ‘pop-up’ messages

The EU General Data Protection Regulation (GDPR) requires that any website which uses cookies to notify users of this fact.

Typically, GDPR cookie compliance is achieved through cookie banners that enable website visitor to accept cookies before continuing to browse any pages on the site. See the example below.

Working with Internal Hyperlinks

If your website uses Google Analytics or similar user-tracking software, you will need to add such a cookie notification to your web pages.

Downloading your sample privacy web page

In this exercise, you will work with the following web page:

You have now saved the one file you need for this Tutorial. There are no sample stylesheets and images to download.

Generate the Privacy Pop-up Message

Your next task is to generate the JavaScript code to create the 'pop-up' message that will display when users first visit your website. Follow these steps.

  1. Go to the Insites web page at this web address:   https://cookieconsent.insites.com/ Project Privacy Click the link named Download Open Source.
  2. Clicking this button does not actually download any files to your computer. It simply brings you to another web page named 'Download Cookie Consent'. See below. Project Privacy At the lower-right of this screen is a button named Start Coding. Click on it.
  3. You are now ready to work through the various Configure options displayed at the left of this screen. This will generate the pop-up message in the Copy the code section at the right of the screen. Project Privacy
  4. On the left of the screen, under the 1: Position heading, you can see that the Banner bottom option is selected by default, You need not change this. Project Privacy
  5. Next, click the 2: Layout heading to view your options. Accept the default layout of Block. Project Privacy
  6. Click the 3: Palette heading and accept the default first option. It shows a yellow button against a black background. Project Privacy 
  7. Click the 4: Learn more link heading and the then click the second option, named Link to your own policy. In the box displayed, enter a web address similar to the following, where username is the username you have chosen for your GitHub account:  https://username.github.io/privacy.html Project Privacy
  8. Click the 5: Compliance type heading and select the first option, Just tell users that we use cookies. Project Privacy
  9. Click the 6: Custom text heading to view the message that will be displayed to the website visitor. You need not change this. Project Privacy
  10. On the right side of the screen, you can see two blocks of code that have been created for your pop-up privacy message.
    • The first is the link to the CSS stylesheet file that controls the appearance of the pop-up message. Project Privacy
    • The second is the JavaScript code that creates the pop-up message. Project Privacy

Leave the Insites cookie code generator screen open in your web browser.

Adding the CSS link and JavaScript code to your privacy web page

Before you copy the above two blocks of JavaScript code, you need an HTML file to paste them into. You will use the template privacy web page for this purpose.

  1. In VS Code, open the bootstrap-privacy-template.html file you downloaded earlier.   In the head of the web page you can see that the only CSS links are the Bootstrap stylesheet (on the Internet) and to the bootstrap-custom.css stylesheet in your assets/css sub-folder. Project Privacy
  2. In your web browser, display to the Insites cookie code generator screen and click the Copy HTML button.
  3. Switch back to VS Code, and paste the Insites CSS link to just before the closing </head> tag of your web page as shown below.   To make your web page easier to read, press the ENTER key to add a blank line before and after the pasted CSS link, and type a comment line such as the following just above it.
    <!-- Insites CSS for popup privacy message -->
    
    Project Privacy
  4. Next, return to the Insites cookie code generator screen and click the Copy code button.
  5. Switch to Visual Studio, and paste the JavaScript code to just before the closing </body> tag at the end of your web page as shown below. Project Privacy You may wish to add the comment line such as the following to just above the pasted JavaScript code.
    <!-- JavaScript for Cookie Consent Popup Message -->
    
  6. In VS Code, save your bootstrap-privacy-template.html file.
  7. In your web browser, you can now close the Insites online cookie generator tab.

That's it. You now have a privacy web page you can include as a template on any web site that uses Google Analytics. To use this template:

Uploading your Bootstrap folder to GitHub

Follow these steps below to upload your entire Bootstrap folder to your website on GitHub.

  1. Open a new tab in your web browser and go to GitHub.com. If you are not already signed in to your GitHub account, sign in now. github-signin
  2. On your GitHub home page, click the name of the repository (‘repo’) that holds your web pages. Its name will look as follows, where username is your chosen username on GitHub.   username.github.io github-signin
  3. On the next GitHub screen displayed, click the Add file button near the right of the screen and choose Upload files from the dropdown list. github-upload-portfolio
  4. In File/Windows Explorer, select your bootstrap folder, and drag-and-drop it to your repository on GitHub. Introduction to Images
  5. Scroll down to the bottom of the GitHub screen, and accept or edit the short message (Add files via upload) in the Commit changes box.   Finally, click the green Commit changes button to upload your entire bootstrap folder and all the files it contains.

Your uploaded web page is published on GitHub at a web address similar to the following, where username is the username you have chosen for your GitHub account:

https://username.github.io/bootstrap/bootstrap-privacy-template.html

It may take a few minutes for your uploaded files to appear on GitHub.



Return to Contents.