]> _ Git - cubist_gtag.git/commitdiff
wip #2609 @0.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 25 Feb 2019 15:06:11 +0000 (16:06 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 25 Feb 2019 15:06:11 +0000 (16:06 +0100)
resources/views/body.blade.php [new file with mode: 0644]
resources/views/head.blade.php [new file with mode: 0644]
resources/views/script.blade.php
src/GtagFrontProvider.php

diff --git a/resources/views/body.blade.php b/resources/views/body.blade.php
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/resources/views/head.blade.php b/resources/views/head.blade.php
new file mode 100644 (file)
index 0000000..f2e5548
--- /dev/null
@@ -0,0 +1,14 @@
+@if($enabled)
+    {{--<!-- Global site tag (gtag.js) - Google Analytics -->--}}
+    <script async src="https://www.googletagmanager.com/gtag/js?id={{$id}}"></script>
+    <script>
+        window.dataLayer = window.dataLayer || [];
+
+        function gtag() {
+            dataLayer.push(arguments);
+        }
+
+        gtag('js', new Date());
+        gtag('config', '{{$id}}');
+    </script>
+@endif
index f2e55483b09a9f28ee6650a21a9d17b9a7e902a4..ea296d0a00c08f6c9e863553e344d8641cd849e3 100644 (file)
@@ -1,14 +1,2 @@
-@if($enabled)
-    {{--<!-- Global site tag (gtag.js) - Google Analytics -->--}}
-    <script async src="https://www.googletagmanager.com/gtag/js?id={{$id}}"></script>
-    <script>
-        window.dataLayer = window.dataLayer || [];
-
-        function gtag() {
-            dataLayer.push(arguments);
-        }
-
-        gtag('js', new Date());
-        gtag('config', '{{$id}}');
-    </script>
-@endif
+@include('gtag::head')
+@include('gtag::body')
index 88a625bfd94df3de6c9e91ee1410eb22dd043adc..d8f4e1392671ec3661dc3293c64b49a6eb379902 100644 (file)
@@ -25,7 +25,7 @@ class GtagServiceProvider extends ServiceProvider
         ], 'views');
 
         $this->app['view']->creator(
-            ['gtag::script'],
+            ['gtag::body', 'gtag::head', 'gtag::script'],
             'Cubist\Gtag\ScriptViewCreator'
         );
     }