我有一个在 heroku 上运行的 sinatra 应用程序。
我的问题:当我转到本地主机 (http://localhost:5000/) 时,我总是被重定向到生产环境 (https://apps.facebook.com/myapp/)。所以我不能再在本地开发了。
我怀疑我添加的自定义谷歌分析与它有关,见下文(来源:. http://www.savio.no/blogg/a/104/how-to-track-facebook-iframes-with-谷歌分析)。它
<script type="text/javascript">
// This script is provided AS IS without warranty of any kind.
// See http://www.savio.no/blogg/a/104/ for more information.
// Smacked together by Eivind Savio May 2011
var FacebookURL = 'http://www.facebook.com/YourFacebookPage?sk=app_123456789';
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXX-X']);
_gaq.push(['_addIgnoredRef', 'static.ak.facebook.com']);
// If Google Analytics is loaded and this page isn't framed inside our Facebook URL, frame the page.
if (_gaq.push && self.location == top.location) {
// Create a fake URL that we can filter in Google Analytics. This pageview also sends the traffic source data to Google Analytics.
_gaq.push(['_trackPageview','/facebook/campaign-tracking/']);
// Tracking done, let's frame the page
setTimeout(top.location.href = FacebookURL, 200);
} else if (self.location == top.location) {
// If Google Analytics doesn't load within 2 seconds, refresh and frame the page anyway. People dislike waiting. Change the time if you like.
setTimeout(top.location.href = FacebookURL, 2000);
} else {
// The Page is Framed. Let's track it.
_gaq.push(['_trackPageview']);
_gaq.push(['_trackPageLoadTime']);
}
(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);
})();
</script>
所以我删除了它,但 heroku 仍然使用它,请参见下面的网络控制台输出第 3 行。这里发生了什么,它是一个没有被删除的缓存吗?有任何想法吗?
[13:12:16.817] GET http://localhost:5000/ [HTTP/1.1 200 OK 395ms]
[13:12:17.330] GET https://apps.facebook.com/myapp/ [HTTP/1.1 200 OK 782ms]
[13:12:17.357] GET http://www.google-analytics.com/__utm.gif?xxxxxxxxxxxxxxxx [HTTP/1.1 200 OK 14ms]
[13:12:17.500] syntax error @ http://localhost:5000/:108
[13:12:18.326] POST https://xxxx.herokuapp.com/ [HTTP/1.1 302 Moved Temporarily 952ms]
[13:12:19.200] GET https://xxxx.herokuapp.com/ [HTTP/1.1 200 OK 734ms]
[13:12:19.827] GET https://xxxx.herokuapp.com/stylesheets/screen.css [HTTP/1.1 200 OK 262ms]
[13:12:19.829] GET https://xxxx.herokuapp.com/stylesheets/mobile.css [HTTP/1.1 200 OK 398ms]
[13:12:19.831] GET https://xxxx.herokuapp.com/javascripts/jquery-1.7.1.min.js [HTTP/1.1 200 OK 1032ms]
[13:12:20.093] GET https://xxxx.herokuapp.com/stylesheets/reset.css [HTTP/1.1 200 OK 135ms]
[13:12:20.096] GET https://xxxx.herokuapp.com/stylesheets/base.css [HTTP/1.1 200 OK 263ms]
[13:12:21.026] GET https://xxxx.herokuapp.com/images/house_suburb.jpg [HTTP/1.1 200 OK 308ms]
[13:12:21.051] GET https://xxxx.herokuapp.com/images/logo.png [HTTP/1.1 200 OK 295ms]
[13:12:21.109] GET https://www.facebook.com/dialog/oauth?api_key=xxxxxxxxxxxxxxxxcode&sdk=joey [HTTP/1.1 302 Found 192ms]