Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose JSON property for Piwik custom trackers #11025

Merged
merged 2 commits into from Dec 16, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion js/piwik.js
Expand Up @@ -1031,7 +1031,7 @@ if (typeof JSON2 !== 'object' && typeof window.JSON === 'object' && window.JSON.
/*members push */
/*global Piwik:true */
/*members addPlugin, getTracker, getAsyncTracker, getAsyncTrackers, addTracker, trigger, on, off, retryMissedPluginCalls,
DOM, onLoad, onReady*/
DOM, onLoad, onReady, JSON */
/*global Piwik_Overlay_Client */
/*global AnalyticsTracker:true */
/*members initialize */
Expand Down Expand Up @@ -6638,6 +6638,8 @@ if (typeof window.Piwik !== 'object') {
Piwik = {
initialized: false,

JSON: JSON2,

/**
* DOM Document related methods
*/
Expand Down
4 changes: 2 additions & 2 deletions js/piwik.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions piwik.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion tests/javascript/index.php
Expand Up @@ -610,7 +610,7 @@ function getLineCountJsLintStarted($src,$contentRemovedFromPos) {
});

test("Piwik plugin methods", function() {
expect(26);
expect(31);

// TESTS FOR retryMissedPluginCalls

Expand Down Expand Up @@ -720,6 +720,12 @@ function callEvent2(arg1, arg2) { calledEvent2++; passedArgs = [arg1, arg2]; }
triggerEvent(_e('click7'), 'myCustomEvent');

strictEqual(true, customEvent, "DOM.addEventListener works");

strictEqual('object', typeof Piwik.JSON, "Piwik.JSON object is defined");
strictEqual('function', typeof Piwik.JSON.stringify, "JSON.stringify method is defined");
strictEqual('function', typeof Piwik.JSON.parse, "JSON.parse method is defined");
strictEqual('[]', Piwik.JSON.stringify([]));
propEqual([], Piwik.JSON.parse('[]'));
});

test("Query", function() {
Expand Down