File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2727
2828<%= yield :additional_js %>
2929
30- <% if ( ENV [ 'MATOMO_CONTAINER_URL ' ] . present? ) %>
30+ <% if ( ENV [ 'MATOMO_URL' ] . present? && ENV [ 'MATOMO_CONTAINER_ID '] . present? ) %>
3131<!-- Matomo Tag Manager -->
3232< script type ="text/javascript ">
3333 var _mtm = window . _mtm = window . _mtm || [ ] ;
3434 _mtm . push ( { 'mtm.startTime' : ( new Date ( ) . getTime ( ) ) , 'event' : 'mtm.Start' } ) ;
3535 ( function ( ) {
3636 var d = document , g = d . createElement ( 'script' ) , s = d . getElementsByTagName ( 'script' ) [ 0 ] ;
37- g . async = true ; g . src = '<%= ENV [ 'MATOMO_CONTAINER_URL ' ] %> ' ; s . parentNode . insertBefore ( g , s ) ;
37+ g . async = true ; g . src = '<%= ENV [ 'MATOMO_URL ' ] %> js/container_ <%= ENV [ 'MATOMO_CONTAINER_ID' ] %> .js ' ; s . parentNode . insertBefore ( g , s ) ;
3838 } ) ( ) ;
39+ if ( ( document . cookie . indexOf ( 'mtmPreview13_<%= ENV [ 'MATOMO_CONTAINER_ID' ] %> %3D1' ) !== - 1 && window . location . href . indexOf ( '&mtmPreviewMode=0' ) === - 1 && window . location . href . indexOf ( '?mtmPreviewMode=0' ) === - 1 ) || window . location . href . indexOf ( '&mtmPreviewMode=<%= ENV [ 'MATOMO_CONTAINER_ID' ] %> ' ) !== - 1 || window . location . href . indexOf ( '?mtmPreviewMode=<%= ENV [ 'MATOMO_CONTAINER_ID' ] %> ' ) !== - 1 ) {
40+ console . log ( 'Loading preview container' ) ;
41+ var d = document , g = d . createElement ( 'script' ) , s = d . getElementsByTagName ( 'script' ) [ 0 ] ;
42+ g . type = 'text/javascript' ; g . async = false ; g . defer = false ; g . src = '<%= ENV [ 'MATOMO_URL' ] %> js/container_<%= ENV [ 'MATOMO_CONTAINER_ID' ] %> _preview.js' ; s . parentNode . insertBefore ( g , s ) ;
43+ } else {
44+ console . log ( 'Skipping preview container' ) ;
45+ }
3946</ script >
4047<!-- End Matomo Tag Manager -->
4148<% elsif ( ENV [ 'MATOMO_URL' ] . present? && ENV [ 'MATOMO_SITE_ID' ] . present? ) %>
You can’t perform that action at this time.
0 commit comments