appscms-tools-theme 3.6.7 → 3.6.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/assets/js/usageTracking.js +38 -32
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 18a339812bdf8cbc4a8c2434eb9c19e296f5743ec0ebceafc573f490ba6abe10
|
|
4
|
+
data.tar.gz: 44733df1d1a19472cf747c9ae7923bc7bed26b1d9fbeba025602f523c1f3f52a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 840487e54f3b56e0b97525a0bdd44b9bdbbb7932ed5f24a0788a0542760ba7f1fd65e7bcf7740c4767375bfe5052b076925d1085a18255ff7882ecbbf772d48d
|
|
7
|
+
data.tar.gz: 97d381946e058c694ed9c7d92a729471636a2ab8fe15bb796e7d9397b05c6963c974121094d2de6136bbe90468047142d2cbce7c02770ac0cc0b1ff7c712d518
|
data/assets/js/usageTracking.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
---
|
|
3
1
|
// Generate a unique ID for the user (if not already generated)
|
|
4
2
|
const generateUserID = () => {
|
|
5
3
|
// Check if the user ID is already stored in cookies or local storage
|
|
@@ -10,8 +8,9 @@ const generateUserID = () => {
|
|
|
10
8
|
}
|
|
11
9
|
|
|
12
10
|
// Example: Generating a random string
|
|
13
|
-
const characters =
|
|
14
|
-
|
|
11
|
+
const characters =
|
|
12
|
+
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
13
|
+
let id = "";
|
|
15
14
|
for (let i = 0; i < 10; i++) {
|
|
16
15
|
id += characters.charAt(Math.floor(Math.random() * characters.length));
|
|
17
16
|
}
|
|
@@ -24,26 +23,24 @@ const generateUserID = () => {
|
|
|
24
23
|
|
|
25
24
|
// Get the stored user ID from cookies or local storage
|
|
26
25
|
const getStoredUserID = () => {
|
|
27
|
-
return localStorage.getItem(
|
|
26
|
+
return localStorage.getItem("userID");
|
|
28
27
|
};
|
|
29
28
|
|
|
30
29
|
// Store the user ID in cookies or local storage
|
|
31
30
|
const storeUserID = (userID) => {
|
|
32
|
-
localStorage.setItem(
|
|
31
|
+
localStorage.setItem("userID", userID);
|
|
33
32
|
};
|
|
34
33
|
|
|
35
34
|
// Get the current date in YYYY-MM-DD format
|
|
36
35
|
const getCurrentDate = () => {
|
|
37
36
|
const today = new Date();
|
|
38
37
|
const year = today.getFullYear();
|
|
39
|
-
const month = String(today.getMonth() + 1).padStart(2,
|
|
40
|
-
const day = String(today.getDate()).padStart(2,
|
|
38
|
+
const month = String(today.getMonth() + 1).padStart(2, "0");
|
|
39
|
+
const day = String(today.getDate()).padStart(2, "0");
|
|
41
40
|
return `${year}-${month}-${day}`;
|
|
42
41
|
};
|
|
43
42
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
let userTrackingCountLimit='{{site.userTrackingCount}}';
|
|
43
|
+
let userTrackingCountLimit = "20";
|
|
47
44
|
const checkUsage = () => {
|
|
48
45
|
const today = new Date().toDateString();
|
|
49
46
|
const usageCount = getCookie("featureUsageCount");
|
|
@@ -61,17 +58,27 @@ const checkUsage = () => {
|
|
|
61
58
|
}
|
|
62
59
|
const userID = generateUserID();
|
|
63
60
|
try {
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
if ((usageCount + 1) % 5 === 0) {
|
|
62
|
+
gtag("event", `feature_used_${usageCount + 1}_times`, {
|
|
66
63
|
user_id: userID,
|
|
67
64
|
userID: userID,
|
|
68
|
-
feature: window.location.pathname + location.search
|
|
65
|
+
feature: window.location.pathname + location.search,
|
|
69
66
|
});
|
|
67
|
+
}
|
|
70
68
|
} catch (error) {
|
|
71
|
-
console.log(error)
|
|
69
|
+
console.log(error);
|
|
72
70
|
}
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
|
|
72
|
+
try {
|
|
73
|
+
gtag("event", "feature_used", {
|
|
74
|
+
user_id: userID,
|
|
75
|
+
userID: userID,
|
|
76
|
+
feature: window.location.pathname + location.search,
|
|
77
|
+
});
|
|
78
|
+
} catch (error) {
|
|
79
|
+
console.log(error);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
75
82
|
const incrementUsageCount = (count) => {
|
|
76
83
|
const today = new Date().toDateString();
|
|
77
84
|
|
|
@@ -90,18 +97,18 @@ const showShareModal = () => {
|
|
|
90
97
|
const handleShare = () => {
|
|
91
98
|
const usageCount = getCookie("featureUsageCount");
|
|
92
99
|
if (usageCount) {
|
|
93
|
-
setCookie("featureUsageCount", 0
|
|
100
|
+
setCookie("featureUsageCount", 0, getExpirationDate());
|
|
94
101
|
}
|
|
95
102
|
document.getElementById("shareModal").style.display = "none";
|
|
96
103
|
try {
|
|
97
104
|
const userID = generateUserID();
|
|
98
|
-
gtag(
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
105
|
+
gtag("event", "feature_shared", {
|
|
106
|
+
user_id: userID,
|
|
107
|
+
userID: userID,
|
|
108
|
+
feature: window.location.pathname + location.search,
|
|
109
|
+
});
|
|
103
110
|
} catch (error) {
|
|
104
|
-
console.log(error)
|
|
111
|
+
console.log(error);
|
|
105
112
|
}
|
|
106
113
|
};
|
|
107
114
|
|
|
@@ -125,13 +132,12 @@ const getExpirationDate = () => {
|
|
|
125
132
|
date.setTime(date.getTime() + 24 * 60 * 60 * 1000); // 24 hours in milliseconds
|
|
126
133
|
return date.toUTCString();
|
|
127
134
|
};
|
|
128
|
-
const socialShare=document.querySelectorAll(
|
|
135
|
+
const socialShare = document.querySelectorAll(".social-share");
|
|
129
136
|
|
|
130
137
|
if (socialShare) {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
+
Array.from(socialShare).map((item) => {
|
|
139
|
+
item.addEventListener("click", () => {
|
|
140
|
+
handleShare();
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
}
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: appscms-tools-theme
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.6.
|
|
4
|
+
version: 3.6.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- vivek-appscms
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-06-
|
|
11
|
+
date: 2023-06-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: jekyll
|