-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 993d43f
Showing
3 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
/** | ||
* InnoCraft - the company of the makers of Piwik Analytics, the free/libre analytics platform | ||
* | ||
* @link https://www.innocraft.com | ||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later | ||
*/ | ||
|
||
namespace Piwik\Plugins\JsTrackerForceAsync; | ||
|
||
class JsTrackerForceAsync extends \Piwik\Plugin | ||
{ | ||
public function registerEvents() | ||
{ | ||
return array( | ||
'Piwik.getJavascriptCode' => array('function' => 'makePiwikJsLoadSync', 'after' => true), | ||
); | ||
} | ||
|
||
public function makePiwikJsLoadSync(&$codeImpl, $parameters) | ||
{ | ||
$codeImpl['loadAsync'] = true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Piwik JsTrackerForceAsync Plugin | ||
|
||
## Description | ||
|
||
This plugin is especially useful in combination with our [A/B Testing](https://plugins.piwik.org/AbTesting) feature | ||
if you embed the tracking code directly in your website using the `SitesManager.getJavascriptTag` [HTTP API](https://developer.piwik.org/api-reference/reporting-api) method. | ||
|
||
When you use A/B Testing and have at least one active experiment for your website, the JavaScript code will load | ||
synchronously to prevent the content to flickr. If you still want to load the Piwik JavaScript Tracking code async, | ||
you can install this plugin and it will make sure to always generate the async code. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "JsTrackerForceAsync", | ||
"description": "Forces the JavaScript Tracker to always load asynchronous when embedding the Tracking Code via HTTP API automatically.", | ||
"version": "3.0.0", | ||
"theme": false, | ||
"require": { | ||
"piwik": ">=3.0.0-b1,<4.0.0" | ||
}, | ||
"authors": [ | ||
{ | ||
"name": "InnoCraft", | ||
"email": "[email protected]", | ||
"homepage": "https://www.innocraft.com" | ||
} | ||
], | ||
"support": { | ||
"issues": "https://github.com/innocraft/plugin-JsTrackerForceAsync/issues", | ||
"source": "https://github.com/innocraft/plugin-JsTrackerForceAsync" | ||
}, | ||
"homepage": "https://www.innocraft.com", | ||
"license": "GPL v3+", | ||
"keywords": ["javascript", "tracker", "async"] | ||
} |