Skip to content

Instantly share code, notes, and snippets.

View franzenzenhofer's full-sized avatar

Franz Enzenhofer franzenzenhofer

  • http://www.fullstackoptimization.com/
  • Vienna, Austria
View GitHub Profile
@franzenzenhofer
franzenzenhofer / hl-en-bookmarklet
Created March 14, 2019 12:22
change any google page to english language
let l = window.location;
const p = new URLSearchParams(l.search);
p.set('hl','en');
window.location.search="?"+p.toString();
//minified bookmarklet code
//javascript:let l=window.location,p=new URLSearchParams(l.search);p.set("hl","en");window.location.search="?"+p.toString();
@franzenzenhofer
franzenzenhofer / minimal-user-interaction.js
Last active February 16, 2024 04:31
minimal-user-interaction Google Tag Manager Tag
<script>
var mui = function()
{
var fired = false;
var kickTrigger = function()
{
if(fired === true){return false;}
//console.log("miniumal-user-interaction");
dataLayer.push({'minimal-user-interaction': true});
{
"exportFormatVersion": 2,
"exportTime": "2020-10-06 15:31:33",
"containerVersion": {
"path": "accounts/6000775609/containers/32949204/versions/0",
"accountId": "6000775609",
"containerId": "32949204",
"containerVersionId": "0",
"container": {
"path": "accounts/6000775609/containers/32949204",
@franzenzenhofer
franzenzenhofer / Google-Apps-Script-Monthly-Traffic-Analysis
Created May 23, 2023 21:25
This Google Apps Script is designed to analyze and visualize web traffic data from Google Sheets. It generates a line chart that displays the total and median clicks for each month, discarding any incomplete months. The chart also includes a trendline to help identify patterns or trends over time. This script is especially useful for SEO analyst…
function createChart() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
// Get the last row with content
var lastRow = sheet.getLastRow();
// Get data range
var dataRange = sheet.getRange('A2:B' + lastRow);
var data = dataRange.getValues();
@franzenzenhofer
franzenzenhofer / Google-Apps-Script-URL-Analysis
Last active May 31, 2023 16:30
currently for TR.client
function analyzeURLs() {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
const data = sheet.getDataRange().getValues();
deleteSheets(['Page Type Analysis', 'Language Namespace Analysis', 'Parameters Analysis', 'Copied & Analyzed']);
// Create a copy of the original sheet
const newSheet = sheet.copyTo(SpreadsheetApp.getActiveSpreadsheet());
newSheet.setName('Copied & Analyzed');
@franzenzenhofer
franzenzenhofer / GSC Devices Bar Chart
Created May 31, 2023 12:26
GSC Devices Bar Chart
function generateCharts() {
// Access the sheet
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Devices');
// Sort Column A
sheet.getRange('A2:E4').sort(1);
// Get the range for your data
var dataRange = sheet.getRange('A1:E4');
@franzenzenhofer
franzenzenhofer / GSC Dates Average Charts
Last active May 31, 2023 16:31
GSC Dates Average Charts
// Global spreadsheet object
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
//console.log(spreadsheet);
function main() {
console.log("main");
generateLineCharts();
}
// Function to delete multiple sheets
@franzenzenhofer
franzenzenhofer / GSC brand unbrand script
Created June 1, 2023 08:49
GSC brand unbrand script
function calculateAndCreatePieChart() {
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var sheet = spreadsheet.getSheetByName('Queries');
var chartSheetName = 'brand';
var brandstring = "radar";
// Remove old chart sheet if exists
var oldChartSheet = spreadsheet.getSheetByName(chartSheetName);
if (oldChartSheet) spreadsheet.deleteSheet(oldChartSheet);
@franzenzenhofer
franzenzenhofer / count clicks by pagetype GSC
Created June 1, 2023 13:49
count clicks by pagetype GSC
function analyzeURLs() {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
const data = sheet.getDataRange().getValues();
deleteSheets(['Page Type Analysis', 'Language Namespace Analysis', 'Parameters Analysis', 'Copied & Analyzed']);
// Create a copy of the original sheet
const newSheet = sheet.copyTo(SpreadsheetApp.getActiveSpreadsheet());
newSheet.setName('Copied & Analyzed');
const axios = require('axios');
const cheerio = require('cheerio');
const argv = require('yargs').argv;
const sleep = require('util').promisify(setTimeout);
const start_url = argv._[0] || '';
const delay = argv.s || 1;
const headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3',