@@ -410,23 +410,25 @@ <h3>{{demo.name}}</h3>
410
410
} ,
411
411
hashchange : function ( ) {
412
412
var hash = window . location . hash ;
413
+ var demo = null ;
413
414
if ( hash ) {
414
415
for ( var i = 0 ; i < this . model . length ; i ++ ) {
415
- var demo = this . model [ i ] ;
416
- if ( demo . hash == hash ) {
417
- this . selected = demo ;
418
- this . selectedHash = demo . hash ;
419
- this . iframeURL = demo . path ;
420
- this . setTitle ( demo ) ;
421
- return ;
416
+ if ( this . model [ i ] . hash == hash ) {
417
+ demo = this . model [ i ] ;
418
+ break ;
422
419
}
423
420
}
424
421
}
425
422
426
- this . selected = null ;
427
- this . selectedHash = '' ;
428
- this . iframeUrl = '' ;
429
- this . setTitle ( null ) ;
423
+ if ( this . selected != demo && window . ga ) {
424
+ ga ( 'set' , 'page' , window . location . pathname + window . location . hash ) ;
425
+ ga ( 'send' , 'pageview' ) ;
426
+ }
427
+
428
+ this . selected = demo ;
429
+ this . selectedHash = demo ? demo . hash : '' ;
430
+ this . iframeURL = demo ? demo . path : '' ;
431
+ this . setTitle ( demo ) ;
430
432
} ,
431
433
setTitle : function ( demo ) {
432
434
if ( demo ) {
@@ -473,5 +475,13 @@ <h3>{{demo.name}}</h3>
473
475
474
476
document . querySelector ( 'web-animations-demos' ) . model = demos ;
475
477
</ script >
478
+ < script >
479
+ ( function ( i , s , o , g , r , a , m ) { i [ 'GoogleAnalyticsObject' ] = r ; i [ r ] = i [ r ] || function ( ) {
480
+ ( i [ r ] . q = i [ r ] . q || [ ] ) . push ( arguments ) } , i [ r ] . l = 1 * new Date ( ) ; a = s . createElement ( o ) ,
481
+ m = s . getElementsByTagName ( o ) [ 0 ] ; a . async = 1 ; a . src = g ; m . parentNode . insertBefore ( a , m )
482
+ } ) ( window , document , 'script' , 'https://www.google-analytics.com/analytics.js' , 'ga' ) ;
483
+ ga ( 'create' , 'UA-82759618-1' , 'auto' ) ;
484
+ ga ( 'send' , 'pageview' ) ;
485
+ </ script >
476
486
</ body >
477
487
</ html >
0 commit comments