Skip to content
This repository was archived by the owner on May 21, 2019. It is now read-only.

Commit e33d08e

Browse files
committed
Add registerFunctionCallTagHandler typing
Minor example update
1 parent 066655e commit e33d08e

File tree

2 files changed

+25
-11
lines changed

2 files changed

+25
-11
lines changed

example/App.js

+18-11
Original file line numberDiff line numberDiff line change
@@ -101,24 +101,31 @@ export default class App extends Component {
101101

102102
tracker.trackScreenView("Hello");
103103

104-
/*GoogleTagManager.openContainerWithId("GT-NZT48")
104+
GoogleTagManager.openContainerWithId("GTM-NZT48")
105105
.then(() => {
106-
return GoogleTagManager.stringForKey("pack");
106+
return GoogleTagManager.registerFunctionCallTagHandler("awzm_tag", (fn, payload) => {
107+
console.log("test", fn, payload)
108+
})
107109
})
108-
.then(str => {
109-
console.log("Str: ", str);
110-
return GoogleTagManager.boolForKey("wat");
110+
.then(() => {
111+
return GoogleTagManager.registerFunctionCallTagHandler("some_other_tag", (fn, payload) => {
112+
console.log("test2", fn, payload)
113+
})
111114
})
112-
.then(wat => {
113-
console.log("Wat: ", wat);
114-
return GoogleTagManager.doubleForKey("orly");
115+
.then(reg => {
116+
console.log("Push?: ", reg);
117+
return GoogleTagManager.pushDataLayerEvent({
118+
event: "some_event",
119+
id: 1
120+
});
115121
})
116-
.then(orly => {
117-
console.log("Orly: ", orly);
122+
.then(db => {
123+
console.log("db: ", db);
124+
return GoogleTagManager.doubleForKey("db");
118125
})
119126
.catch(err => {
120127
console.log(err);
121-
});*/
128+
});
122129

123130
return (
124131
<View style={styles.container}>

types/index.d.ts

+7
Original file line numberDiff line numberDiff line change
@@ -352,4 +352,11 @@ export class GoogleTagManager {
352352
* @returns {Promise<boolean>}
353353
*/
354354
static setVerboseLoggingEnabled(enabled: boolean): Promise<boolean>
355+
356+
/**
357+
* Register Function Call tag handler
358+
* @param {String} functionName
359+
* @param {Function} handler
360+
*/
361+
static registerFunctionCallTagHandler(functionName: string, handler: (functionName: string, tagArguments: any) => any): Promise<boolean>
355362
}

0 commit comments

Comments
 (0)