Last active
August 29, 2015 14:18
-
-
Save duncanmorris/70fb2ec4d0180aa7b504 to your computer and use it in GitHub Desktop.
Using PhantomJS to monitor Google Analytics - example 1
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
var page = require('webpage').create(); | |
var url = 'http://crawlbin.com/response_301/'; | |
console.log('Loading: ' + url); | |
page.open(url, function (status) { | |
//Page is loaded! | |
if (url != page.url){ | |
console.log('Redirected: ' + page.url) | |
} | |
phantom.exit(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage:
phantomjs example1.js
Output:
Loading: http://crawlbin.com/response_301/
Redirected: http://crawlbin.com/