forked from Expensify/App
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Expensify#51201 from Expensify/arosiclair-gtm-lib
[No QA] Add GoogleTagManger libs
- Loading branch information
Showing
11 changed files
with
259 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
{ | ||
"project_info": { | ||
"project_number": "921154746561", | ||
"firebase_url": "https://expensify-chat.firebaseio.com", | ||
"project_id": "expensify-chat", | ||
"storage_bucket": "expensify-chat.appspot.com" | ||
}, | ||
"client": [ | ||
{ | ||
"client_info": { | ||
"mobilesdk_app_id": "1:921154746561:android:4f04268f25f84eaf027c40", | ||
"android_client_info": { | ||
"package_name": "com.expensify.chat" | ||
} | ||
}, | ||
"oauth_client": [ | ||
{ | ||
"client_id": "921154746561-gpsoaqgqfuqrfsjdf8l7vohfkfj7b9up.apps.googleusercontent.com", | ||
"client_type": 3 | ||
} | ||
], | ||
"api_key": [ | ||
{ | ||
"current_key": "AIzaSyCVwQb9lBI06bDIwHOw10AkdJyquXoMngk" | ||
} | ||
], | ||
"services": { | ||
"appinvite_service": { | ||
"other_platform_oauth_client": [ | ||
{ | ||
"client_id": "921154746561-gpsoaqgqfuqrfsjdf8l7vohfkfj7b9up.apps.googleusercontent.com", | ||
"client_type": 3 | ||
}, | ||
{ | ||
"client_id": "921154746561-080fav7kvk6s70k6nd70mt50isubgff4.apps.googleusercontent.com", | ||
"client_type": 2, | ||
"ios_info": { | ||
"bundle_id": "com.expensify.chat.adhoc" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
{ | ||
"client_info": { | ||
"mobilesdk_app_id": "1:921154746561:android:333e293a7fef83a8027c40", | ||
"android_client_info": { | ||
"package_name": "com.expensify.chat.adhoc" | ||
} | ||
}, | ||
"oauth_client": [ | ||
{ | ||
"client_id": "921154746561-gpsoaqgqfuqrfsjdf8l7vohfkfj7b9up.apps.googleusercontent.com", | ||
"client_type": 3 | ||
} | ||
], | ||
"api_key": [ | ||
{ | ||
"current_key": "AIzaSyCVwQb9lBI06bDIwHOw10AkdJyquXoMngk" | ||
} | ||
], | ||
"services": { | ||
"appinvite_service": { | ||
"other_platform_oauth_client": [ | ||
{ | ||
"client_id": "921154746561-gpsoaqgqfuqrfsjdf8l7vohfkfj7b9up.apps.googleusercontent.com", | ||
"client_type": 3 | ||
}, | ||
{ | ||
"client_id": "921154746561-080fav7kvk6s70k6nd70mt50isubgff4.apps.googleusercontent.com", | ||
"client_type": 2, | ||
"ios_info": { | ||
"bundle_id": "com.expensify.chat.adhoc" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
{ | ||
"client_info": { | ||
"mobilesdk_app_id": "1:921154746561:android:3b19fdbaedb5b586027c40", | ||
"android_client_info": { | ||
"package_name": "com.expensify.chat.dev" | ||
} | ||
}, | ||
"oauth_client": [ | ||
{ | ||
"client_id": "921154746561-svjnccrcn6vet45kn9o7sibb3jemipa6.apps.googleusercontent.com", | ||
"client_type": 1, | ||
"android_info": { | ||
"package_name": "com.expensify.chat.dev", | ||
"certificate_hash": "5e8f16062ea3cd2c4a0d547876baa6f38cabf625" | ||
} | ||
}, | ||
{ | ||
"client_id": "921154746561-gpsoaqgqfuqrfsjdf8l7vohfkfj7b9up.apps.googleusercontent.com", | ||
"client_type": 3 | ||
} | ||
], | ||
"api_key": [ | ||
{ | ||
"current_key": "AIzaSyCVwQb9lBI06bDIwHOw10AkdJyquXoMngk" | ||
} | ||
], | ||
"services": { | ||
"appinvite_service": { | ||
"other_platform_oauth_client": [ | ||
{ | ||
"client_id": "921154746561-gpsoaqgqfuqrfsjdf8l7vohfkfj7b9up.apps.googleusercontent.com", | ||
"client_type": 3 | ||
}, | ||
{ | ||
"client_id": "921154746561-080fav7kvk6s70k6nd70mt50isubgff4.apps.googleusercontent.com", | ||
"client_type": 2, | ||
"ios_info": { | ||
"bundle_id": "com.expensify.chat.adhoc" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} | ||
], | ||
"configuration_version": "1" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CLIENT_ID</key> | ||
<string>921154746561-8niu5ba8g4dgsqsqso3lugdhe6vikqpq.apps.googleusercontent.com</string> | ||
<key>REVERSED_CLIENT_ID</key> | ||
<string>com.googleusercontent.apps.921154746561-8niu5ba8g4dgsqsqso3lugdhe6vikqpq</string> | ||
<key>ANDROID_CLIENT_ID</key> | ||
<string>921154746561-cbegir0tnc2gan6k1gre5vtn75p60hom.apps.googleusercontent.com</string> | ||
<key>API_KEY</key> | ||
<string>AIzaSyA9Qn7q5Iw26gTzjI7012C4PaFrFagpC_I</string> | ||
<key>GCM_SENDER_ID</key> | ||
<string>921154746561</string> | ||
<key>PLIST_VERSION</key> | ||
<string>1</string> | ||
<key>BUNDLE_ID</key> | ||
<string>com.expensify.chat.dev</string> | ||
<key>PROJECT_ID</key> | ||
<string>expensify-chat</string> | ||
<key>STORAGE_BUCKET</key> | ||
<string>expensify-chat.appspot.com</string> | ||
<key>IS_ADS_ENABLED</key> | ||
<false></false> | ||
<key>IS_ANALYTICS_ENABLED</key> | ||
<false></false> | ||
<key>IS_APPINVITE_ENABLED</key> | ||
<true></true> | ||
<key>IS_GCM_ENABLED</key> | ||
<true></true> | ||
<key>IS_SIGNIN_ENABLED</key> | ||
<true></true> | ||
<key>GOOGLE_APP_ID</key> | ||
<string>1:921154746561:ios:12c3a0b9276d7d2f027c40</string> | ||
<key>DATABASE_URL</key> | ||
<string>https://expensify-chat.firebaseio.com</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import analytics from '@react-native-firebase/analytics'; | ||
import Log from '@libs/Log'; | ||
import type {GoogleTagManagerEvent} from './types'; | ||
import type GoogleTagManagerModule from './types'; | ||
|
||
function publishEvent(event: GoogleTagManagerEvent, accountID: number) { | ||
analytics().logEvent(event, {accountID}); | ||
Log.info('[GTM] event published', false, {event, accountID}); | ||
} | ||
|
||
const GoogleTagManager: GoogleTagManagerModule = { | ||
publishEvent, | ||
}; | ||
|
||
export default GoogleTagManager; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import Log from '@libs/Log'; | ||
import type {GoogleTagManagerEvent} from './types'; | ||
import type GoogleTagManagerModule from './types'; | ||
|
||
/** | ||
* The dataLayer is added with a js snippet from Google in web/thirdPartyScripts.js. Set USE_THIRD_PARTY_SCRIPTS to true | ||
* in your .env to enable this | ||
*/ | ||
type WindowWithDataLayer = Window & { | ||
dataLayer?: { | ||
push: (params: DataLayerPushParams) => void; | ||
}; | ||
}; | ||
|
||
type DataLayerPushParams = { | ||
event: GoogleTagManagerEvent; | ||
accountID: number; | ||
}; | ||
|
||
declare const window: WindowWithDataLayer; | ||
|
||
function publishEvent(event: GoogleTagManagerEvent, accountID: number) { | ||
if (!window.dataLayer) { | ||
return; | ||
} | ||
|
||
window.dataLayer.push({event, accountID}); | ||
Log.info('[GTM] event published', false, {event, accountID}); | ||
} | ||
|
||
const GoogleTagManager: GoogleTagManagerModule = { | ||
publishEvent, | ||
}; | ||
|
||
export default GoogleTagManager; |
Oops, something went wrong.