Make Google Analytics support correct types for _gaq.push() (#35962)

It seems that `_gaq.push` can accept not only strings, but boolean
and numbers as well. This commit fixes the types declarations for it
according to the documentation:
https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiEventTracking#_trackevent
This commit is contained in:
Denis Demchenko
2019-06-05 11:08:14 -07:00
committed by Andrew Casey
parent 4d8103200e
commit 9f076daf85
2 changed files with 4 additions and 1 deletions
@@ -106,6 +106,9 @@ describe("tester Google Analytics Code _gaq object", () => {
_gaq.push(['_gat._anonymizeIp']);
_gaq.push(['_trackPageview']);
// more details: https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiEventTracking#_trackevent
_gaq.push(['_trackEvent', 'category', 'action_name', undefined, undefined, true]);
_gaq.push(() => {
const tracker = _gat._getTrackerByName('UA-65432-1');
tracker._trackPageview();
+1 -1
View File
@@ -19,7 +19,7 @@ declare class Tracker {
}
interface GoogleAnalyticsCode {
push(commandArray: string[]): void;
push(commandArray: Array<string|boolean|number>): void;
push(func: Function): void;
}