MCPcopy Create free account
hub / github.com/Olanetsoft/article-idea-generator / incrementLocalClickCount

Function incrementLocalClickCount

lib/analytics.ts:97–110  ·  view source on GitHub ↗
(code: string)

Source from the content-addressed store, hash-verified

95 * Update click count for a local short URL
96 */
97export function incrementLocalClickCount(code: string): void {
98 if (typeof window === "undefined") return;
99 try {
100 const urls = getLocalShortUrls();
101 const url = urls.find((u) => u.code === code);
102 if (url) {
103 url.clicks = (url.clicks || 0) + 1;
104 url.lastClickAt = new Date().toISOString();
105 localStorage.setItem(LOCAL_URLS_KEY, JSON.stringify(urls));
106 }
107 } catch (error) {
108 console.error("Error updating click count:", error);
109 }
110}
111
112// ============================================================================
113// Local Storage - Click Events

Callers 1

saveLocalClickEventFunction · 0.85

Calls 1

getLocalShortUrlsFunction · 0.70

Tested by

no test coverage detected