appscms-tools-theme 3.6.6 → 3.6.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/assets/js/usageTracking.js +66 -4
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 65588e3032d192ae700cd9794d32054c936d730b8b7cee11383030f1a2c23e45
4
- data.tar.gz: 8f18ce4956a9e51b7e90f82396b834e328f6332fcc4cf9342a868046ca4a7f43
3
+ metadata.gz: 54025741868d133ecbdcfd5d563abfa8c02f80b48fd1387abd564e4fac836f46
4
+ data.tar.gz: bfca025ac2fed0ded5ab34a2f7ab02729a2ec67380414a4cfef53f4049e9b978
5
5
  SHA512:
6
- metadata.gz: b71a062aa7bf0cfee40c9ab9287fb0e7d713e1d452b1f9298dc83f5efc03cb2fbc6708be004c5df3ff4e7e38a5b6f3b9d334941c10a2ec65c4dec49fffb359a2
7
- data.tar.gz: bab231bd24c1567f57ac0d33c9fe1116c388ea915d3b9627b5b16f46b3325acb310aa0d0445b61477460437e106785e0579c62f53744a20ebcb212049e158f7d
6
+ metadata.gz: 3b261cec09acc02f6b7e1b237de84d73fb20564d9513a86bd8bd4720f99a77a1fb39af477517cf722aa858b64c376ccbcf94a14a27ae6519a936fd1c350da716
7
+ data.tar.gz: 79ac73ef06575e7bcda7f38cb0951b15b2609477d0fc87b5f8f1cfa3b4d4138efc30dc0b21ab67ff97ce9d15cb7440d3d08f956671c36de0d66a28d047a2c3dd
@@ -1,5 +1,47 @@
1
1
  ---
2
2
  ---
3
+ // Generate a unique ID for the user (if not already generated)
4
+ const generateUserID = () => {
5
+ // Check if the user ID is already stored in cookies or local storage
6
+ const storedUserID = getStoredUserID();
7
+
8
+ if (storedUserID) {
9
+ return storedUserID;
10
+ }
11
+
12
+ // Example: Generating a random string
13
+ const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
14
+ let id = '';
15
+ for (let i = 0; i < 10; i++) {
16
+ id += characters.charAt(Math.floor(Math.random() * characters.length));
17
+ }
18
+
19
+ // Store the generated user ID in cookies or local storage
20
+ storeUserID(id);
21
+
22
+ return id;
23
+ };
24
+
25
+ // Get the stored user ID from cookies or local storage
26
+ const getStoredUserID = () => {
27
+ return localStorage.getItem('userID');
28
+ };
29
+
30
+ // Store the user ID in cookies or local storage
31
+ const storeUserID = (userID) => {
32
+ localStorage.setItem('userID', userID);
33
+ };
34
+
35
+ // Get the current date in YYYY-MM-DD format
36
+ const getCurrentDate = () => {
37
+ const today = new Date();
38
+ const year = today.getFullYear();
39
+ const month = String(today.getMonth() + 1).padStart(2, '0');
40
+ const day = String(today.getDate()).padStart(2, '0');
41
+ return `${year}-${month}-${day}`;
42
+ };
43
+
44
+
3
45
 
4
46
  let userTrackingCountLimit='{{site.userTrackingCount}}';
5
47
  const checkUsage = () => {
@@ -17,8 +59,19 @@ const checkUsage = () => {
17
59
  // First usage of the day
18
60
  setCookie("featureUsageCount", 1, getExpirationDate());
19
61
  }
20
- };
21
-
62
+ const userID = generateUserID();
63
+ try {
64
+
65
+ gtag('event', 'feature_used', {
66
+ user_id: userID,
67
+ userID: userID,
68
+ feature: window.location.pathname + location.search
69
+ });
70
+ } catch (error) {
71
+ console.log(error)
72
+ }
73
+
74
+ }
22
75
  const incrementUsageCount = (count) => {
23
76
  const today = new Date().toDateString();
24
77
 
@@ -37,10 +90,19 @@ const showShareModal = () => {
37
90
  const handleShare = () => {
38
91
  const usageCount = getCookie("featureUsageCount");
39
92
  if (usageCount) {
40
- // Decrement the usage count by 1 if the user has already used the feature today
41
- setCookie("featureUsageCount", usageCount , getExpirationDate());
93
+ setCookie("featureUsageCount", 0 , getExpirationDate());
42
94
  }
43
95
  document.getElementById("shareModal").style.display = "none";
96
+ try {
97
+ const userID = generateUserID();
98
+ gtag('event', 'feature_shared', {
99
+ user_id: userID,
100
+ userID: userID,
101
+ feature: window.location.pathname + location.search
102
+ });
103
+ } catch (error) {
104
+ console.log(error)
105
+ }
44
106
  };
45
107
 
46
108
  const getCookie = (name) => {
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.6
4
+ version: 3.6.7
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-10 00:00:00.000000000 Z
11
+ date: 2023-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll