How to create a blogspot/blogger template license with google sheet

Updated on July 08, 2022
how to create a blogspot/blogger template license with google sheet

As we know premium templates that we often encounter on average have a license, of course, the purpose is that the templates created are not used incorrectly by people who are not responsible, such as distributing them for free or reselling them without the knowledge of the template developer.

for those of you who are developing blogger templates and planning to sell them, it would be nice to install a license first on the template you made before marketing it so that you can avoid things that are not wanted, therefore here I will share how to make a blogspot / blogger template license with google sheet.

What Is Google Sheet

google Sheets includes one of the features of Google Drive (unlimited online storage service) developed by the technology company Google.

most workers and students are probably quite familiar with the Google Sheets service. To make things easier, this service is often called Sheets.

the shape or format of the spreadsheet itself is arguably similar to Microsoft Excel, in it is composed of columns and rows.

Generally, spreadsheets can be operated online and allow users to edit documents/files in spreadsheets anytime and anywhere.

How to Create a Google Sheet

You must have a Gmail account. If you don't already have one, please create a Gmail account (gmail.com) first before using a spreadsheet.

if your Gmail account already exists, you can start using spreadsheets online via url: https://docs.google.com/spreadsheets In the browser, 'Start a New Spreadsheet' will appear. Click 'Blank' at the bottom of the sentence to create a new spreadsheet.

You can edit the Google Sheets anytime and anywhere. All data changes every time you finish typing will be saved automatically.

How Licensing Works

before we start the tutorial I will first discuss a little first how the license works which we will make later, as in general the licensed template uses a unique code created by perUsers and 1 license can only be used by 1 domain or 1 blog only and if you want to install it on another domain then the license code is different again. most licensed templates use "base64 code" like this bGlzZW5zaXRlbXBsYXRla29kZWJh= and the license is active forever the developer does not have access to remove the license that has been granted to users because the license does not have a database.

and the way that I will share here is actually the same way it works, but the difference is that we have access to delete users' licenses because we use a google sheet database that will hold users' licenses so when we delete users' data in our spreadsheet then the users site / blog will be redirected to our site. alright so that's the only difference ok let's just start to how it's made below.

Licensed Template Sample

so that there is no reason it can't then I make a sample in the Contempo template for tests or demos, as long as the demo template is still working then there is no reason it can't be as long as you follow this tutorial correctly then no one can't, please download the sample template that I have paired the license below and if you want to test the license input you can contact me to get the license..

How To Create Blogspot / Blogger Template License With Google Sheet

    1. silakan masuk ke https://drive.google.com
    2. silakan buat google spreadsheet baru dengan cara klik tombol pilih google spreadsheet klik spreadsheet kosongBaru
how to create a blogspot/blogger template license with google sheet

    1. Sheet1 at the bottom of the left is renamed users. if so, make a name in the column with the words no with the words id and with the writing code, on the Tools / Tools menu click the script editor, later it will be directed to a new tab and a google script worksheet appears. see the image below.A1B1C1
how to create a blogspot/blogger template license with google sheet

    1. in the code.gs remove the default script from the google script and replace it with the script below.
function doGet(e){
 // Ubah Spread Sheet url
 var ss = SpreadsheetApp.openByUrl("https://docs.google.com/spreadsheets/d/17IDJM3BCEX3ilbBfzkJ6QFPPeLZvhLS_HT0dG7PUHDI/edit#gid=0");
// Ubah Nama Sheet Disini
 var sheet = ss.getSheetByName("users");
 return getUsers(sheet);
}
function getUsers(sheet){
 var jo = {};
 var dataArray = [];
// Mengambil bari dari sheet, dan mengubah nama di record
 var rows = sheet.getRange(2,1,sheet.getLastRow()-1, sheet.getLastColumn()).getValues();
 for(var i = 0, l= rows.length; i<l ; i++){
 var dataRow = rows[i];
 var record = {};
 record['id'] = dataRow[1];
 record['code'] = dataRow[2];
 dataArray.push(record);
 }
 jo.user = dataArray;
 var result = JSON.stringify(jo);
 return ContentService.createTextOutput(result).setMimeType(ContentService.MimeType.JSON);
} 
replace the https://docs.google.com/spreadsheets/d/1tOCJ2WzeGmAtA8VD403TXb4Kybr7fZQbsrO7XedMa4g/edit#gid=0 link with the google sheet link you created earlier.
  1. save script.google by clicking the icon and write the name of the free worksheet just up to you, after that select the publish menu tab select apply as a web application.save

if it is already going to appear the popup modal. For the project version just fill in with the number 1, execute the app as just let me (emailkalian@gmail.com), and who has access to the app select anyone, even anonymous. If you have clicked deploy

after that there will be an Authorization Requered popup aimed at allowing our project to read, create, and delete files that are in google drive. Therefore, we just click Review Permission Select a google account click continue to click the words open your project name (unsafe) which is under click allow. finally copy the link that you just made, later it will be used as a take JOSN data in our google sheet.

Stage Two of Creating a License in Blogger

at this stage, you have to make sure that the pasted that will create the license already has a jQuery script. Because the data to be retrieved uses ajax, here are two ajaxs that we must create, namely ajax from the feed / posts / summary to retrieve the blog ID and ajax from the google web app link that we just created to validate and match the data in the google sheet with the blog ID and license code.

if the blog is not already installed jQuery please paste the code on top of the </head>


<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js'></script>

log in the blogger account and into the menu - select it, please copy and paste the code below combine it with the javascript in your templatetemaedit html

var urlBlog = 'https://blog.choipanwendy.com';
var license = $('#license-code').text();
var informasibatas = '<style>body{background:#fff}#peringatan span{font-size:50px}#peringatan{z-index:99999;position:fixed;top:0;right:0;left:0;height:30%;text-align:center;background:rgba(235, 0, 0, 1);border:5px solid #444;color:#fff;padding:70px 30px;font-family:monospace;border-radius:10px}#peringatan h4{font-size:20px}</style><div id="peringatan"><h4>Activate Templates</h4><p>Untuk mendapatkan lisensi Anda bisa menghubungi Admin blog.choipanwendy.com | 0813 1123 3392</p><span id="batas-waktu-template">20</span></div>';
function nolicense() {
 $(document.body).html(informasibatas);
 var mydiv = document.getElementById("batas-waktu-template"),
 time = setInterval(getcounter, 1000);
 function getcounter() {
 if (mydiv.textContent <= 0) {
 window.location.href = urlBlog;
 clearInterval(time);
 } else {
 setTimeout(function() {
 mydiv.textContent -= 1;
 }, 1000);
 }
 }
}
$(document).ready(function() {
 var dataLicense = license.split('-');
 var codeLicense = dataLicense[0];
 var arrayLicense = dataLicense[1];
 console.log(codeLicense);
 console.log(arrayLicense);
 if (arrayLicense === undefined) {
 nolicense();
 }
 str = [arrayLicense];
 $.ajax({
 url: "https://script.google.com/macros/s/AKfycby-rMOUPGBMFk2fNvoR5xdCvIaNaCVkyqq7k_dI5SIDPSnkxoxy/exec",
 type: "GET",
 data: "users",
 crossDomain: true,
 dataType: "",
 success: function(data) {
 // mengambil data JSON dari user google sheet
 var json = data.user;
 // mengambil data dari Array ke-n
 var sheetLicense = json[str];
 console.log(sheetLicense)
 if (sheetLicense === undefined) {
 nolicense();
 }
 // mengambil data dari sheet, ada ID dan Code
 var ID = sheetLicense.id;
 var code = sheetLicense.code;
 // Mengambil data ID Blog dengan Ajax
 $.ajax({
 url: "/feeds/posts/summary/?alt=json",
 type: "get",
 dataType: "jsonp",
 success: function(data) {
 // Mengambil ID Blog dari post summary blogger
 var dataID = data.feed.id.$t;
 console.log(dataID)
 // Hasil tag:blogger.com,1999:blog-4666907241397774044, yang kita butuhkan hanya ID jadi butuh kita eksplode
 var IDblog = dataID.split('-');
 // Hasil eksplode - akan ada dua array yaitu tag:blogger.com,1999:blog dan 4666907241397774044 ["tag:blogger.com,1999:blog", "4666907241397774044"]
 var blogID = IDblog[1];
 try {
 var dataInBlog = blogID + codeLicense,
 dataInSheet = ID + code;
 if (dataInBlog === dataInSheet) {
 return;
 }
 nolicense();
 } catch (input) {
 window.location.href = urlBlog;
 }
 },
 });
 },
 });
});

and place this code above the header to make it easier for users to fill in the license through the layout


<b:section id='license' name='License' showaddelement='false'>
 <b:widget id='HTML55' locked='true' title='License' type='HTML' version='2' visible='true'>
 <b:widget-settings>
 <b:widget-setting name='content'>letakkan kode lisensi di sini</b:widget-setting>
 </b:widget-settings>
 <b:includable id='main'>
<div id='license-code'><data:content/></div>
</b:includable>
 </b:widget>
 </b:section>

so that the license code does not appear on the blog we use the css below

#license-code{display:none!important}
on https://blog.choipanwendy.com please change it to your blog url, the purpose if users do not enter a license to redirect to that url. 0813 1123 3392 change your mobile number, this comes out during a notif before redirecting to the main blog. https://script.google.com/macros/s/AKfycby-rMOUPGBMFk2fNvo R5xdCvIaNaCVkyqq7k_dI5SIDPSnkxoxy/exec replace it with the google script link you created earlier in the first stage.

How To Activate Licenses For Users

  1. if everything is done now I will tell you how to create a license for your users, here you need to know the BLOG ID on the template to be paired with the license. you can use or type view-source:https://domainuser.com and look for code like this {'blogId': '5432787597195842010', just copy the angkka section.ctrl u
  2. then enter the spreadsheet you enter the BLOG ID that was copied earlier into the column section id
  3. and enter the license in the field code
  4. the blank column section does not need to be filled inno
how to create a blogspot/blogger template license with google sheet

can you see here I suppose I have 3 users and each of them has a different license code if my first license is wendycode then what I give to the user is wendycode-0 and my second license is testoko then what I give to the user is testoko-1 my third license is alung then what I give to the user is alung-2

so when you give a license to users, you must add -0 -1 -2 -3 and so on after the license code that you have created. and ask users to enter the license in the layout section called license.

that's all the ways to create a blogspot / blogger template license with google sheet hopefully useful, and thanks to mas azid as the owner of the Science Column blog for letting me rewrite this tutorial

References:
www.azid45.web.id/2020/12/lisensi-blogger-dengan-google-sheet.html

https://www.wendycode.com/2020/12/cara-membuat-lisensi-template-blogspot-blogger-dengan%20google-sheet.html

Gửi link bài viết sang điện thoại:
Share this: pinterest