Showing posts with label IT. Show all posts
Showing posts with label IT. Show all posts

How to Add a Blog or Website Subscription Option

Let´s explore step by step how to make subscription form for your blog or website which can allow your visitors to subscribe your blog or website. 

Normally you will find two options on internet: 

1.- You can use the google form and excel sheet to create a subscription form and then insert the codes in html of your blog or website. 

However, I personally do not like it because the subscription form looks like embedded and it changes the frontpage look of your blog or website.   

2.- You can write a java script to create a subscription form and then link that form with an email. If a visitor of your blog or website fills the form and click on submission button, it will open the visitor´s email account and by this way the visitor will send you an email with data which you asked in subscription form. 

However, I personally do not like it because mostly, on submission, it does not open visitor´s email account or visitor will avoid to login to email account considering this action could be dangerous for email.  

3.- You can register with any website which provide codes for subscription option and you can insert this code in your website. But, in this case, all data will be stored on the server of that website. Many of them put limitation such as you can not send many emails to subscribers, or you can have only a certain number of subscribers etc. On passing those limitations, the website owner will charge you for the service. May be you can loose the data in any circumstance. 

Again, I personally do not like it because lose of subscribers data is a big lose and it has an impact on your own blog or website. 

So how to solve this issue? 

I am going to explain you step by step a procedure which I explored and used on my website www.Latestfoto.com  

Do it all these steps on Google Chrome. Mozilla or Microsoft Edge or any other will not work. 

1.- Open the google drive. 

2.- Open a new google sheet. 

3.- Change the permission of your google sheet clicking on "Share" button: Any one with the link can open"



4.-  Now click on "Extension" to open "Apps Script". 


5.- Now copy and paste the script which I provide you. 


function doPost(e) {
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Sheet1'); // Adjust the s
  var data = JSON.parse(e.postData.contents);
 
  // Append the new data to the sheet
  sheet.appendRow([data.name, data.email, new Date()]);
 
  // Return a success message
  return ContentService.createTextOutput(JSON.stringify({ result: 'success' }))
                       .setMimeType(ContentService.MimeType.JSON);
}

6.- Now click on "Deploy" and New Deployment, select "Web application". 
















   7.- Write description, select "Anyone" for Who has access and at click on "Deploy". 

8.- You will see an url with your project deployment ID. Copy the url.  

https://script.google.com/macros/s/YOUR-DEPLOYMENT-ID/exec

9.- Now copy and paste following code in your website where ever you want to insert a subscription form to your web visitor. 

<form id="subscriptionForm">
  <label for="name">Name:</label><br />
  <input type="text" id="name" name="name" required /><br /><br />
  
  <label for="email">Email:</label><br />
  <input type="email" id="email" name="email" required /><br /><br />
  
  <input type="submit" value="Subscribe" />
</form>

<script>
  document.getElementById('subscriptionForm').addEventListener('submit', function(e) {
    e.preventDefault(); // Prevent the form from submitting the usual way
    
    var formData = new FormData(e.target);
    var name = formData.get('name');
    var email = formData.get('email');
    
    // Send the form data to your Google Apps Script
    fetch('https://script.google.com/macros/s/YOUR-DEPLOYMENT-ID/exec', {
      method: 'POST',
      body: JSON.stringify({ name: name, email: email })
    })
    .then(response => response.json())
    .then(data => {
      if (data.result === 'success') {
        alert('Subscription successful!');
      } else {
        alert('There was an error with your subscription.');
      }
    });
  });
</script>

10.- Replace the url of this code with your copied url with deployment ID. 

11.- Test the subscription by subscribing yourself. 

13.- If it does work, let me know it. 

How to Hide the Featured Post from Other Posts on Your Blogspot Blog

Very simple you have to add following code in the html code of featured post.

 cond='data:view.isHomepage' 

 How to add it.

1:- Open Edit HTML. 



2:- Click on following icon.

3:- Click on FeaturedPost1. 


4:- Add code: cond='data:view.isHomepage' as shown in following image. 

5:- Save the HTML and close it. Refresh your blog, you will not see featured post on other posts of your blog.
Book & Save: Tiqets Kiwi GetYourGuide Amazon
Advertisement
AI Advisor — Ask me anything
Stays active all session
Hi! Ask me about travel, immigration, Spain, India, or any topic on Latestfoto.com. I find posts, affiliate deals, and follow-up questions for you.
Best places in Spain? Cheap flights Madrid US immigration 2026 India travel guide Free tours Europe
✨ Free AI Skin Analysis! Try Now →

✈️ Flight Deals

Error fares & cheap flights — updated daily

Loading flight deals…

Flight

facebook

Featured Post

XIV verbena Republicana Valladolid

The Verbena Republicana in Valladolid is a recurring music and community festival with a republican pol...

Last 30 days' visitors

AI Advisor
AI Advisor

Look what is published:

Try Desktop
Purchase from

chat

Ask a Question

Enhance Your Success with Increased Visitor Engagement!
Ready to leave your mark? Partner with us and witness your business flourish!

7 Days-Popular Articles


How to Find Articles Relevant to Your Interest.

Top Internet Search Topics.

Join Our Writing Community!

🚀✍️ Embrace your passion for words and turn your free time into an exciting writing adventure & earning! Collaborate with us and elevate your writing game. 🌟

🚀✍️ Explore the world of guest writing and enjoy the added bonus of a backlink to your blog. Let's create captivating content together! 🌟

Scan QR code. Buy me a coffee.

Enjoying This Website?

Give Us Your Vote!

Follow Us on Facebook

Follow Us on Facebook

Follow Us Now!

Buy & Sell Your Video

Have an interesting video? Earn money by sharing it with us.

Learn a Language for Travel, PR, or Citizenship

Offer Your Own Language
-------------------------
See More. Do More. Share More.
Join Our Newsletter

Get exclusive discounts & travel tips straight to your inbox.

Please type this word to confirm you're human:

© Latestfoto.com — Questions. Curiosity. Discoveries.