File tree Expand file tree Collapse file tree 2 files changed +27
-5
lines changed Expand file tree Collapse file tree 2 files changed +27
-5
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ const cpFile = require('cp-file')
44
55const ASSETS = [
66 `${ __dirname } /netlify-logo.png` ,
7- `${ __dirname } /assets .js` ,
7+ `${ __dirname } /script .js` ,
88 `${ __dirname } /../../node_modules/analytics/dist/analytics.min.js` ,
99 `${ __dirname } /../../node_modules/analytics-plugin-ga/dist/analytics-plugin-ga.min.js`
1010]
Original file line number Diff line number Diff line change 11/* eslint-env browser */
2- var Analytics = window . _analytics . init ( {
3- plugins : [ window . analyticsGA ( { trackingId : 'UA-42258181-19' } ) ]
4- } )
5- Analytics . page ( )
2+ var init = function ( ) {
3+ setupAnalytics ( )
4+ window . addEventListener ( 'load' , redirectToNewHash )
5+ }
6+
7+ var setupAnalytics = function ( ) {
8+ var Analytics = window . _analytics . init ( {
9+ plugins : [ window . analyticsGA ( { trackingId : 'UA-42258181-19' } ) ]
10+ } )
11+ Analytics . page ( )
12+ }
13+
14+ // The previous API documentation used different fragments. We redirect those
15+ // to the new links.
16+ var redirectToNewHash = function ( ) {
17+ var oldHash = OLD_HASH_REGEXP . exec ( document . location . hash )
18+ if ( oldHash === null ) {
19+ return
20+ }
21+
22+ document . location . hash = '#operation/' + oldHash [ 1 ]
23+ }
24+
25+ var OLD_HASH_REGEXP = / ^ # \/ d e f a u l t \/ ( .+ ) /
26+
27+ init ( )
You can’t perform that action at this time.
0 commit comments