Skip to content
This repository was archived by the owner on Feb 17, 2022. It is now read-only.

Commit 374dc1c

Browse files
author
Robert Kummer
authored
Merge pull request #43 from WaveHack/master
Add config to disable script block
2 parents b9ffabd + d449a47 commit 374dc1c

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

src/Ipunkt/LaravelAnalytics/AnalyticsServiceProvider.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,16 @@ public function register()
5959
$providerConfig = Config::get($packageNamespace . 'analytics.configurations.' . $provider);
6060
}
6161

62-
// return an instance
63-
return new $providerClass($providerConfig);
62+
// make provider instance
63+
$instance = new $providerClass($providerConfig);
64+
65+
// check if we want to prematurely disable the script block
66+
if (Config::get($packageNamespace . 'analytics.disable_script_block', false)) {
67+
$instance->disableScriptBlock();
68+
}
69+
70+
// return the provider instance
71+
return $instance;
6472
});
6573
}
6674

@@ -83,4 +91,4 @@ private function isLaravel4()
8391
{
8492
return version_compare(\Illuminate\Foundation\Application::VERSION, '5', '<');
8593
}
86-
}
94+
}

src/config/analytics.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,9 @@
6565

6666
],
6767

68+
/**
69+
* disable Analytics <script> block
70+
*/
71+
'disable_script_block' => false,
72+
6873
];

0 commit comments

Comments
 (0)