Read more

Digital marketing course Google

In my current job, I’m working on a project where we need to create an app for the digital marketing agency in our area that involves the use of web development with Javascript. The idea is that someone from this agency would be able to access a database, and pull data into an application on a phone or laptop that they can then use to generate sales leads. Our goal is to have the system run 24/7 so the user doesn’t even need to leave their laptop. We also want this system to automatically convert those visitors into paying customers over time, so if everyone uses it consistently this will help us get a higher conversion rate.

The process for creating the client dashboard is relatively simple for me but it does require some work around HTML and CSS. Here’s what each part looks like in detail:

For the website, we’ve set up two separate pages – one with the landing page and another with the application page. These are shown below:

Each page has its own heading (for example “Application Page”). It works as expected because when you hover an element it triggers an event listener on this page using JavaScript. This tells the browser what button belongs on this page, and makes sure the content inside is rendered correctly. To make things look nicer I’ve used padding on the left side, to give the page structure and style. You could add more elements like images and other text, but I wanted to keep things clean here.

These pages are connected in the backend via some API’s which allow users to interact with them from any location. Below is a diagram showing how these are connected (based off screenshots):

The purpose of all this stuff is to be able to connect this back-end system to a front end. In addition to being a way to create dynamic websites, it allows people to send emails directly to clients with the code. For example, our email service is hosted at gmail.com. Each time a potential customer clicks on an email link a request gets made to our backend system, this sends a transaction record to our main page. By using cookies and HTTP headers in the correct order, the page knows it should display exactly one record of each transaction. Next, some Javascript is then written to fetch data from the database, and push it through the browser, passing in information about the person who clicked on your email link from the user object. Once the result is received by the server it can simply show up in the right place on the screen, based on where the file was uploaded. There are a few different ways to do this with the Gmail service, for example, using a CMS like WordPress, or just sending out a pre-written script from scratch. One thing to note here is that due to the timing of the results being processed, you may not see the result immediately (it takes around 2 seconds to receive an email), but once completed it shows up right underneath the email message. If your email provider (like google) doesn’t support this functionality, there are plenty of solutions available. However for simplicity and brevity I’m going to use only this solution.

So now that everything is in place, let’s move forward trying to get this done! Unfortunately, this isn’t ideal, we don’t have much space, resources, and it requires quite a bit of effort. First, we’ll start by making a simple contact form with only a dummy name, address, and phone number.

Once we’ve got it ready, we need to write something that will ask the user to fill out the details once the form is submitted. Let’s start by writing the following in JS:

I’ve added a variable of type Number so that this only evaluates the value when the user fills in the field. This means that even though we’re asking for the first name, address, or phone number, if this is something too complex, we can use the “*” operator and still get “None of your info”. It’s important to note we haven’t given the user any fields to enter in advance so when you click submit, it doesn’t automatically save the data, instead it completes the submission form and saves to the spreadsheet. That way if nothing changes between submitting and completing it, we know we didn’t save anything and haven’t entered anything incorrect.

Next, we need to write a function that can pull the appropriate data and use it within the rest of the program. A little bit of research led me to find this python library called pandas, which helps to read large amounts of data. When I first started playing around with this library I noticed that it had quite a big price tag as a full installation costs $80 (which includes a license fee). Luckily today, Pandas is free as long as you only download the sample data. After downloading this file, execute it and we have the necessary files to write the above functions. To check if the scripts worked, open up the terminal and run the command…

This should output the following :

This also tells us that indeed the input validation function worked properly and sent no errors. Now we can write our logic! Since we want to create a new account every time someone logs into the site, we need to tell the program not to repeat itself until someone enters their name. So in the first function we write this line in brackets:

And then write our actual code…

As you’re reading this you may notice that it’s repeating some lines back and forth. Don’t worry, I just put in some indentation in case anyone stumbles upon these sections in a search engine. Also, the indentation helps for clarity as this needs to happen multiple times. As you can see, the first couple lines are pretty straight forward although the second block makes sense. We loop through each individual row, adding a counter to track the total number of records (the last number will increment automatically throughout the loop). Finally, before we start printing out this list, we need to use a conditional statement so that we can detect whether the user entered their names correctly and continue with processing their details. This is where we do an additional check and if they don’t match the username listed in the previous step we return to the first step and print out a blank screen.

In this section, I added a check in the third line that checks if both the user input is correct and the password is present. If the user input is wrong, the user will be sent back to their original step. If they were incorrectly password protected, then they’ll go back to the first step and be redirected on to the next one. With this in mind, that’s it for this blog post! Feel free to reach out with comments or questions. Thank you!