Skip to content

Commit 8447de2

Browse files
authored
fin
1 parent 997ce2a commit 8447de2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+29921
-0
lines changed

GoogleAnalytics.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
3+
var CLIENT_ID_KEY = "settings:clientId";
4+
var analytics = navigator.analytics;
5+
6+
if (analytics) {
7+
analytics.setTrackingId("UA-45806093-6");
8+
analytics.set(analytics.Fields.CLIENT_ID, getClientId());
9+
analytics.set(analytics.Fields.APP_NAME, "تطبيق أخبار جامعة الملك سعود");
10+
analytics.sendEvent("application", "start");
11+
}
12+
13+
function getClientId() {
14+
var clientId = localStorage.getItem(CLIENT_ID_KEY);
15+
if (clientId == null) {
16+
clientId = generateUUID();
17+
localStorage.setItem(CLIENT_ID_KEY, clientId);
18+
}
19+
return clientId;
20+
}
21+
22+
function generateUUID() {
23+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
24+
var r = Math.random() * 16 | 0;
25+
return (c === "x" ? r : r & 0x3 | 0x8).toString(16);
26+
});
27+
}
28+
29+
module.exports = {
30+
31+
sendEvent: function (category, action, label) {
32+
if (analytics) {
33+
analytics.sendEvent(category, action, label);
34+
}
35+
}
36+
37+
};

amaken_hafs.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)