Last active
May 14, 2018 05:07
-
-
Save koni/6e564852c2b1b806070a37b42c37f281 to your computer and use it in GitHub Desktop.
ランディングページのURLを記録してSocialDogのURLを書き換える
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
// ランディングページのパスをCookieに記録し、URLを置換する | |
document.addEventListener('DOMContentLoaded', function(){ | |
var val = document.cookie.replace(/(?:(?:^|.*;\s*)sd_lp_path\s*\=\s*([^;]*).*$)|^.*$/, "$1"); | |
var new_val = "http://blog.whotwi.com" + document.location.pathname; | |
if (!val) { | |
document.cookie="sd_lp_path=" + new_val + "; path=/;max-age=36000"; | |
} | |
var utm_campaign = (val ? val + '__' + new_val : new_val); | |
var new_url = "https://social-dog.net/?utm_source=blog&utm_medium=web&utm_campaign=" + encodeURIComponent(utm_campaign); | |
$('a[href="http://bit.ly/socialdog-blog"]').attr('href', new_url) | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment