Skip to content

Instantly share code, notes, and snippets.

View ju1's full-sized avatar

ju1

View GitHub Profile
@ju1
ju1 / facebook-wca-standard-events.html
Created May 4, 2016 17:45 — forked from danielmcclure/facebook-wca-standard-events.html
Sample Facebook Standard Events for New Facebook WCA (Website Custom Audience) Pixel
<!-- Facebook Custom Audience Pixel Code - Placed on Every Page of Site -->
<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','//connect.facebook.net/en_US/fbevents.js');
fbq('init', '{{facebook pixel}}');
fbq('track', 'PageView');
</script>
<script>
FB.Event.subscribe('edge.create', function(targetUrl) {
dataLayer.push({
'event': 'socialInteraction',
'socialNetwork': 'Facebook',
'socialAction': 'Like',
'socialTarget': targetUrl
});
});
</script>
<script>
if (typeof twttr !== 'undefined') {
twttr.ready(function (twttr) {
twttr.events.bind('tweet', tweetIntentToAnalytics);
twttr.events.bind('retweet', retweetIntentToAnalytics);
twttr.events.bind('favorite', favIntentToAnalytics);
twttr.events.bind('follow', followIntentToAnalytics);
});
}
function clickEventToAnalytics() {
<script>
dataLayer.push({
'event': 'socialInteraction',
'socialNetwork': 'Linkedin',
'socialAction': 'Share',
'socialTarget': window.location.href
});
</script>
<script>
var els, i, len, title;
var konamiCode = '38,38,40,40,37,39,37,39,66,65';
var keyPresses = [];
var checkKonami = function(e) {
keyPresses.push(e.keyCode);
if (keyPresses.slice(keyPresses.length-10).join() === konamiCode) {
runKonami();
}
};
<script>
(function() {
if (typeof document.querySelectorAll === "undefined") {
return
}
window.addEventListener('beforeunload', function(e) {
findUnsubmittedForms().forEach(function(it) {
window.dataLayer.push({
'event' : 'formAbandonment',
'eventCategory' : 'Form Abandonment',
@ju1
ju1 / twitterRecipe.json
Last active February 26, 2017 19:49
Twitter Recipe for Google Tag Manager
{
"exportFormatVersion": 2,
"exportTime": "2017-02-26 19:48:48",
"containerVersion": {
"path": "accounts/1164259306/containers/6423374/versions/0",
"accountId": "1164259306",
"containerId": "6423374",
"containerVersionId": "0",
"container": {
"path": "accounts/1164259306/containers/6423374",
@ju1
ju1 / facebookRecipe.json
Created February 26, 2017 19:59
Facebook Recipe for Google Tag Manager
{
"exportFormatVersion": 2,
"exportTime": "2017-02-26 19:59:02",
"containerVersion": {
"path": "accounts/1164259306/containers/6423582/versions/0",
"accountId": "1164259306",
"containerId": "6423582",
"containerVersionId": "0",
"container": {
"path": "accounts/1164259306/containers/6423582",
@ju1
ju1 / formAbandonmentRecipe.json
Created February 26, 2017 20:33
Form Abandonment Recipe for Google Tag Manager
{
"exportFormatVersion": 2,
"exportTime": "2017-02-26 20:31:25",
"containerVersion": {
"path": "accounts/1164259306/containers/6423900/versions/0",
"accountId": "1164259306",
"containerId": "6423900",
"containerVersionId": "0",
"container": {
"path": "accounts/1164259306/containers/6423900",
@ju1
ju1 / youtubeListenerV2.json
Last active August 31, 2017 21:36
Youtube Player Listener V2 (by Cardinal Path)
{
"exportFormatVersion": 2,
"exportTime": "2017-08-31 21:35:48",
"containerVersion": {
"path": "accounts/1164259306/containers/6426838/versions/0",
"accountId": "1164259306",
"containerId": "6426838",
"containerVersionId": "0",
"container": {
"path": "accounts/1164259306/containers/6426838",