Skip to content

Instantly share code, notes, and snippets.

View mak00s's full-sized avatar

Mak Shimizu mak00s

  • Tokyo, Japan / Draper, Utah
View GitHub Profile
@mak00s
mak00s / erase-url-parameter-gaq.js
Last active May 6, 2018 05:32
キャンペーン用URLパラメータをキレイにする(ga.js)
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_setAllowAnchor', true]);
_gaq.push(function(){
if (location.hash && location.hash.match(/(#|&)(utm_source|__utma)=.+/)) {
if ('replaceState' in history)
history.replaceState('',document.title, location.pathname + location.search);
else location.hash = '';
}
});
_gaq.push(['_trackPageview']);
@mak00s
mak00s / erase-url-parameter-scode1.js
Created November 5, 2017 11:08
キャンペーン用URLパラメータをキレイにする(s_code.js)part 1 of 2
// パラメータ名「cid」の部分は適宜変更
s.campaign = getHashQueryParam('cid');
// クエリにも同時対応する場合は以下のように書ける
s.campaign = s.getQueryParam('cid') || s.getHashQueryParam('cid');
@mak00s
mak00s / erase-url-parameter-scode2.js
Created November 5, 2017 11:10
キャンペーン用URLパラメータをキレイにする(s_code.js)part 2 of 2
// s.t();の後に下記を追加する
if (location.hash && location.hash.match(/#cid=.+/)) {
if ('replaceState' in history)
history.replaceState('', document.title, location.pathname + location.search);
else window.location.hash = '';
}
@mak00s
mak00s / itunes-auto-link-maker-tag
Last active May 6, 2018 05:32
iTunesのAuto Link Makerのタグを改善した例
@mak00s
mak00s / google-spreadsheet-dataTables.html
Last active July 19, 2018 15:03
Google SpreadsheetのデータをAPIで抽出してjQueryとdataTableでHTMLの表を作るJSスクリプト
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.css">
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#example').dataTable({
"bServerSide": false,
"bProcessing": true,
"sAjaxDataProp": "feed.entry",
"sAjaxSource": "https://spreadsheets.google.com/feeds/list/[keyをここへ]/od6/public/values?alt=json",
"aoColumns": [{
@mak00s
mak00s / pardot-tag-2017
Last active May 6, 2018 05:30
Pardot導入のために発行されるタグ(2017年時点、無加工)
<script type="text/javascript">
piAId = '123456';
piCId = '1234';
(function() {
function async_load(){
var s = document.createElement('script'); s.type = 'text/javascript';
s.src = ('https:' == document.location.protocol ? 'https://pi' : 'http://cdn') + '.pardot.com/pd.js';
var c = document.getElementsByTagName('script')[0]; c.parentNode.insertBefore(s, c);
}
if(window.attachEvent) { window.attachEvent('onload', async_load); }
@mak00s
mak00s / gist:3a60027585c6299968f27d577cf1b757
Created May 6, 2018 05:29
pardot-tag-2017-optimized-1
piAId = '123456';
piCId = '1234';
(function() {
var s = document.createElement('script'); s.type = 'text/javascript';
s.src = ('https:' == document.location.protocol ? 'https://pi' : 'http://cdn') + '.pardot.com/pd.js';
var c = document.getElementsByTagName('script')[0]; c.parentNode.insertBefore(s, c);
})();
@mak00s
mak00s / gist:35c889849d2cf4e8763e5f0de278a45e
Created May 6, 2018 05:29
pardot-tag-2017-optimized-2
piAId = '123456';
piCId = '1234';
(function(d, t) {
var s = d.createElement(t); s.type = 'text/javascript';
s.src = ('https:' == d.location.protocol ? 'https://pi' : 'http://cdn') + '.pardot.com/pd.js';
var c = d.getElementsByTagName(t)[0]; c.parentNode.insertBefore(s, c);
})(document, 'script');
function s_doPlugins(s){
switch(s.channel){
case 'NV':
s.events="event1";
s.products=";;;;event1=3";
s.eVar1="+3";
break;
case 'CS':
s.events="event1";
s.products=";;;;event1=5";
@mak00s
mak00s / gtm-civic-cookie-control-v8.html
Last active May 19, 2018 05:13
CIVIC Cookie Control V8をGoogle Tag Managerで導入するためのタグ