Skip to content

Instantly share code, notes, and snippets.

@vhsu
vhsu / Adwords Script - Get Today's Cost
Last active April 9, 2018 21:15
Adwords Script - Get Current Adwords Cost for today
// Author : Vincent Hsu twitter.com/suisseo
// This function returns the total cost for today
function getTodayTotalCost(){
var totalcost = AdWordsApp.currentAccount().getStatsFor("TODAY").getCost();
}
return totalcost;
}
@vhsu
vhsu / Adwords Script - Modify TargetedLocation Bids
Last active August 29, 2015 13:57
Adwords Script - Modify TargetedLocation Bids
// Author Vincent Hsu @suisseo
// In this example the targeted location bids are increased by 10% (0.10)
var locationSelector = AdWordsApp.targeting()
.targetedLocations()
//.withCondition("CampaignName CONTAINS_IGNORE_CASE 'somecampaignName'")
var locationIterator = locationSelector.get();
while (locationIterator.hasNext()) {
var location = locationIterator.next();
@vhsu
vhsu / Google Analytics - Sitewide Content Experiment With Get Var as Trigger
Last active August 29, 2015 13:57
Google Analytics - Sitewide Content Experiment With Get Var as Trigger
// D'ont forget to change suisseo.ch en your own domain
// 12036452-2 in the expid of your experiment
// test = 1 to the variable that will trigger the change
// Author : Vincent Hsu twitter.com/suisseo
<script>
_udn ="suisseo.ch";
</script>
<script>
function getUrlVars(url) {
@vhsu
vhsu / Check for Ajax.js
Last active August 31, 2021 08:27
Check for Ajax
// Overwrites Ajax requests on a page, used to track ajax stuff with tag manager, or to test stuff with visual website
// optimizer or optimizely
function addXMLRequestCallback(callback){
let oldSend, i;
if( XMLHttpRequest.callbacks ) {
// we've already overridden send() so just add the callback
XMLHttpRequest.callbacks.push( callback );
} else {
// create a callback queue
@vhsu
vhsu / Importer bdd mysql
Last active April 16, 2018 20:30
Importer une grosse bdd mysql sur un serveur ovh privé
1.Uploader la Base de donnée à transférer en sql ou gzip via le ftp (avec winscp par exemple)
2 : Récupérer les infos pour la connexion SSH avec le serveur de fichier
Serveur SSH : ssh.cluster***.ovh.net
Utilisateur : ******
Mot de passe : ******
Télécharger Putty et faire bien attention d'aller dans connection et mettre par exemple 120s (Seconds between keepalives (0 to turn of)) pour éviter d'être sans cesse déconnecté
@vhsu
vhsu / Lazy Load Google Remarketing & Conversion Javascript Module.js
Last active October 25, 2018 20:05
Google Adwords Asynchronous Remarketing Javascript Module - Lazy Loading Adwords Conversion Code
// This module can be used to trigger the Google Adwords remarketing or conversion tag asynchronously only when you need it (lazy loading) without loading unused ressources
// Mostly useful when the Google Remarketing tag or Conversion tag is triggered only on specific conditions.
// Author : Vincent Hsu -> twitter.com/suisseo -> http://www.suisseo.ch
// Language : Javascript
// Usage : googremarketing.loadTag(conversionid, conversionlabel)
// Start Google Remarketing Module
var googremarketing = (function() {
var asyncload = 0;
// Load Async Google Adwords remarketing code
function Gremloader() {
@vhsu
vhsu / Google Spreadsheets Script - Sum By Date
Last active December 12, 2015 01:12
Google Spreadsheets Script - Sum By Date
// Sum all rows by day in a 2 column Google Spreadsheet containing a date and a number : I use it with a trigger that runs every day
// To free space in a constantly updated spreadsheet.
// Author : Vincent Hsu -> twitter.com/suisseo -> http://www.suisseo.ch
// Language : Javascript
// Usage : aggregateDailySum(tabname,days)
// where tabname is the a string containing the name of the tab to update and days a number : if days is for example 1 the script
// will look look for all rows containing yesterday's date in the first column and sum the numbers in the second column, then it will
// delete the rows and insert the summed up row. Dates must be sorted in order for the script to work.
@vhsu
vhsu / gist:08c586c3621f486dd88a
Last active January 5, 2016 19:56 — forked from russorat/gist:7446125
AdWords Script to check sitelinks
function main() {
Logger.log('AdWordsApp.extensions().sitelinks() list.');
logSitelinks(AdWordsApp);
Logger.log('Campaign and AdGroup list.');
var campIter = AdWordsApp.campaigns().get();
while(campIter.hasNext()) {
var camp = campIter.next();
logSitelinks(camp);
var agIter = camp.adGroups().get();
@vhsu
vhsu / Sitelinks Check ( MCC Script)
Last active March 5, 2016 11:35
Sitelinks Check ( MCC Script)
@vhsu
vhsu / Sitelinks Check ( Account Level)
Last active March 5, 2016 11:34
Check if sitelinks are broken : Adwords account level script