Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tsteur committed Jan 23, 2017
0 parents commit 993d43f
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
24 changes: 24 additions & 0 deletions JsTrackerForceAsync.php
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;
}
}
10 changes: 10 additions & 0 deletions README.md
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.
23 changes: 23 additions & 0 deletions plugin.json
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"]
}

0 comments on commit 993d43f

Please sign in to comment.