-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanalytics.html
More file actions
executable file
·272 lines (234 loc) · 14.9 KB
/
analytics.html
File metadata and controls
executable file
·272 lines (234 loc) · 14.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
<!DOCTYPE html>
<!-- saved from url=(0099)https://secure.assets.tumblr.com/analytics.html?f89dd274a76812e35873eeb31ba5162c#http://meteroi.com -->
<html><script async="" src="https://sb.scorecardresearch.com/c2/15742520/cs.js"></script><script async="" src="https://sb.scorecardresearch.com/c2/15742520/cs.js"></script><script async="" src="./analytics.js"></script><script type="text/javascript" async="" src="./ga(1).js"></script><script id="tinyhippos-injected">if (window.top.ripple) { window.top.ripple("bootstrap").inject(window, document); }</script><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Tumblr</title>
<meta name="robots" content="noindex, nofollow">
<link rel="icon" href="https://assets.tumblr.com/images/favicons/favicon.ico?_v=a891a6916b745ae20be499f98db2f875" type="image/gif">
<script src="./rapid-3.36.1(1).js"></script>
<script src="./rapidworker-1.2(1).js"></script>
<script type="text/javascript">
function log(message) {
if (debug) console.log(message);
}
var user_logged_in = 'No';
var blog_is_nsfw = 'No';
var parent_origin = location.hash.slice(1);
window.parent.postMessage('analytics_iframe_loaded', parent_origin);
var Tumblr = {
Analytics: {
get_cookie: function (name){
return new RegExp(name+"=([^;]+)").test(unescape(document.cookie)) ? RegExp.$1 : null;
},
set_cookie: function(name, value, expire_seconds, opts) {
opts = opts || {};
var ex_date = new Date();
var path = opts.path ? opts.path : '/';
var is_secure = opts.is_secure ? true : false;
var domain = opts.domain ? opts.domain : '';
ex_date.setTime(ex_date.getTime() + (expire_seconds * 1000));
document.cookie = name + "=" + escape(value)
+ ((expire_seconds == null) ? "" : ";expires=" + ex_date.toGMTString())
+ ';path=' + path
+ ((is_secure === false) ? '' : ';secure')
+ ((domain === '') ? '' : ';domain=' + domain);
},
unset_cookie: function(name) {
this.set_cookie(name, '', -1);
},
create_post_message_listener: function() {
// http://davidwalsh.name/window-iframe
// Create IE + others compatible event handler
var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent";
var eventer = window[eventMethod];
var messageEvent = eventMethod == "attachEvent" ? "onmessage" : "message";
// Listen to message from child window
eventer(messageEvent,function(e) {
var message = (e.data && e.data.split) ? e.data.split(';') : '';
Tumblr.Analytics.handle_post_message(message, e.origin);
}, false);
},
handle_post_message: function(message, origin) {
switch (message[0]) {
case 'openInMobileApp':
var post_id = parseInt(message[1]),
custom_event = ['_trackEvent', 'Mobile', 'Clicked', 'Open in Mobile App', post_id ];
_gaq.push(custom_event);
parent.postMessage('openInMobileAppSuccess' + ';' + post_id, message[2]);
break;
case 'tick_google_analytics':
// ajax message format: tick_google_analytics; is_ajax; path; override_route
// non-ajax message format: tick_google_analytics; is_ajax; user_logged_in; blog_is_nsfw; path;
var is_ajax = message[1];
var track_url;
if (is_ajax == 'false') {
user_logged_in = message[2];
blog_is_nsfw = message[3];
track_url = Tumblr.Analytics.get_ga_url(message.slice(4, message.length));
// post message here to notify parent window that non-ajax load message is received
window.parent.postMessage('analytics_iframe_ga_non_ajax_received', parent_origin);
} else if (is_ajax == 'true') {
track_url = Tumblr.Analytics.get_ga_url(message.slice(2, message.length));
}
if (track_url) {
log('Tracking GA: ' + '/analytics.html?page=' + track_url + "; user_logged_in="+user_logged_in + "; is_nsfw="+blog_is_nsfw);
// set GA custom variable for user_logged_in status
_gaq.push(['_setCustomVar', 2, 'User_Logged_In', user_logged_in, 3]);
ga('set', 'dimension2', user_logged_in);
// set GA custom variable for nsfw
_gaq.push(['_setCustomVar', 3, 'NSFW', blog_is_nsfw, 3]);
ga('set', 'dimension3', blog_is_nsfw);
_gaq.push(['_trackPageview', '/analytics.html?page=' + track_url]);
ga('send', 'pageview', '/analytics.html?page=' + track_url);
}
break;
case 'enable_comscore':
case 'tick_comscore':
var url = message[1];
log({ c1: "7", c2: 15742520, c4: url });
log({ c1: "2", c2: 15742520, c4: url });
if (typeof(COMSCORE) !== 'undefined') {
COMSCORE.beacon({ c1: '7', c2: '15742520', c4: url });
COMSCORE.beacon({ c1: '2', c2: '15742520', c4: url });
} else {
_comscore.push({ c1: "7", c2: 15742520, c4: url });
_comscore.push({ c1: "2", c2: 15742520, c4: url });
var s = document.createElement("script"),
el = document.getElementsByTagName("script")[0];
s.async = true;
s.src = (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/c2/15742520/cs.js";
el.parentNode.insertBefore(s, el);
}
break;
case 'enable_addthis':
if (!this.get_cookie('addthis')) {
// set the cookie to expire in a month
this.set_cookie('addthis', true, 30*24*3600);
var el = document.getElementsByTagName("script")[0],
addthis_iframe = document.createElement("iframe");
addthis_iframe.width = 1;
addthis_iframe.height = 1;
addthis_iframe.scrolling = 'no';
addthis_iframe.src = "//safe.txmblr.com/addthis.html";
el.parentNode.insertBefore(addthis_iframe, el);
}
break;
case 'tick_rapid':
var is_ajax = message[1];
var route = message[2];
var user_logged_in = message[3];
var tumblelog_id = message[4];
var yahoo_space_id = message[5];
var rapid_client_only = message[6];
var apv = message[7];
var rapid_ex = message[8];
if (!is_ajax) {
var YAHOO = window.YAHOO;
if (YAHOO) {
var keys = {
pd: route,
_li: user_logged_in,
b_id: tumblelog_id,
i_rad: 0,
i_strm: 0
};
var conf = {
webworker_file: '/assets/scripts/vendor/yahoo/rapid/rapidworker-1.2.js',
spaceid: yahoo_space_id,
client_only: rapid_client_only,
keys: keys,
nol: 1,
fpc: true,
query_parameters: true
};
if (!apv) {
conf.apv = false;
}
if (rapid_ex) {
conf.ex = true;
}
YAHOO.rapid = new YAHOO.i13n.Rapid(conf);
}
} else {
try {
var YAHOO = window.YAHOO;
if (YAHOO && YAHOO.rapid) {
var keys = {
pd: route,
_li: user_logged_in,
i_rad: 0,
i_strm: 0,
b_id: tumblelog_id
};
YAHOO.rapid.beaconEvent('tpv', keys);
if (tumblelog_id) {
YAHOO.rapid.refreshModule('container');
}
}
} catch(err) {
Tumblr.Utils.exceptions(err);
}
}
break;
case 'tick_related_post':
// temporary disabled
break;
}
},
get_url_var: function(get_var, url) {
url = url || window.location.href
var vars = {};
url.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
vars[key] = value;
});
if (get_var) {
return vars[get_var];
} else {
return vars;
}
},
get_ga_url: function(message) {
var parser = document.createElement('a');
message = message || [];
if (message[0] === '') message[0] = '/';
parser.href = message[0] || document.referrer;
var page_uri = parser.href;
var page_path = parser.pathname;
// Make sure path starts with a /
if (!page_path.match(/^\//)) page_path = '/' + page_path;
if (page_path.match(/^\/analytics\.html/)) return false;
// Add parameters as needed.
page_path += '&route=' + (message[1] || Tumblr.Analytics.get_url_var('route', page_uri));
if (Tumblr.Analytics.get_url_var('utm_campaign')) page_path += '&utm_campaign=' + Tumblr.Analytics.get_url_var('utm_campaign');
if (Tumblr.Analytics.get_url_var('utm_medium')) page_path += '&utm_medium=' + Tumblr.Analytics.get_url_var('utm_medium');
if (Tumblr.Analytics.get_url_var('utm_source')) page_path += '&utm_source=' + Tumblr.Analytics.get_url_var('utm_source');
return page_path;
}
}
};
var debug = false
, _gaq = _gaq || []
, _comscore = _comscore || [];
_gaq.push(['_setAccount', 'UA-97144-8']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_setDomainName', 'tumblr.com']);
(function(){
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
// Google Universal Analytics
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-97144-14', 'tumblr.com', {
'allowLinker': true,
'sampleRate': 0.7
});
Tumblr.Analytics.create_post_message_listener();
</script>
<noscript><img src="https://sb.scorecardresearch.com/p?c1=7&amp;c2=15742520&amp;cv=2.0&amp;cj=1" /></noscript>
<noscript><img src="https://sb.scorecardresearch.com/p?c1=2&amp;c2=15742520&amp;cv=2.0&amp;cj=1" /></noscript>
</head>
<body>
</body></html>