mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Merge pull request #11643 from ianks/react-ga-set
react-ga: add set method definition
This commit is contained in:
commit
191bc9e02d
@ -8,11 +8,11 @@ describe("Testing react-ga initialize object", () => {
|
||||
});
|
||||
it("Able to initailize react-ga object", () => {
|
||||
let ga = __reactGA;
|
||||
|
||||
|
||||
let options: __reactGA.InitializeOptions = {
|
||||
debug: true,
|
||||
}
|
||||
|
||||
|
||||
ga.initialize("UA-65432-1", options);
|
||||
});
|
||||
});
|
||||
@ -21,7 +21,7 @@ describe("Testing react-ga pageview calls", () => {
|
||||
it("Able to make pageview calls", () => {
|
||||
let ga = __reactGA;
|
||||
ga.initialize("UA-65432-1");
|
||||
|
||||
|
||||
ga.pageview("http://telshin.com");
|
||||
});
|
||||
});
|
||||
@ -30,7 +30,7 @@ describe("Testing react-ga modal calls", () => {
|
||||
it("Able to make modal calls", () => {
|
||||
let ga = __reactGA;
|
||||
ga.initialize("UA-65432-1");
|
||||
|
||||
|
||||
ga.modalview("Test modal");
|
||||
});
|
||||
});
|
||||
@ -39,7 +39,7 @@ describe("Testing react-ga event calls", () => {
|
||||
it("Able to make event calls", () => {
|
||||
let ga = __reactGA;
|
||||
ga.initialize("UA-65432-1");
|
||||
|
||||
|
||||
let options: __reactGA.EventArgs = {
|
||||
category: "Test",
|
||||
action: "CI",
|
||||
@ -47,7 +47,20 @@ describe("Testing react-ga event calls", () => {
|
||||
value: 4,
|
||||
nonInteraction: true,
|
||||
}
|
||||
|
||||
|
||||
ga.event(options);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("Testing react-ga set calls", () => {
|
||||
it("Able to make set calls", () => {
|
||||
let ga = __reactGA;
|
||||
ga.initialize("UA-65432-1");
|
||||
|
||||
let fieldObject: __reactGA.FieldsObject = {
|
||||
page: '/users'
|
||||
};
|
||||
|
||||
ga.set(fieldObject);
|
||||
});
|
||||
});
|
||||
|
||||
5
react-ga/react-ga.d.ts
vendored
5
react-ga/react-ga.d.ts
vendored
@ -16,10 +16,15 @@ declare namespace __reactGA {
|
||||
debug?: boolean;
|
||||
}
|
||||
|
||||
export interface FieldsObject {
|
||||
[i: string]: any;
|
||||
}
|
||||
|
||||
export function initialize(trackingCode: string, options?: InitializeOptions): void;
|
||||
export function pageview(path: string): void;
|
||||
export function modalview(name: string): void;
|
||||
export function event(args: EventArgs): void;
|
||||
export function set(fieldsObject: FieldsObject): void;
|
||||
}
|
||||
|
||||
declare module 'react-ga' {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user