MCPcopy
hub / github.com/msgbyte/tianji / batchSendEvents

Function batchSendEvents

example/web/src/app/page.tsx:151–393  ·  view source on GitHub ↗
(eventType: string, eventTitle: string)

Source from the content-addressed store, hash-verified

149 };
150
151 const batchSendEvents = async (eventType: string, eventTitle: string) => {
152 if (isBatchSending) return;
153
154 setIsBatchSending(true);
155 setBatchProgress(0);
156
157 const batchSize = 100;
158 const chunkSize = 10; // Send 10 events at a time to avoid overwhelming
159
160 try {
161 for (let i = 0; i < batchSize; i += chunkSize) {
162 const currentChunk = Math.min(chunkSize, batchSize - i);
163
164 // Send a chunk of events
165 for (let j = 0; j < currentChunk; j++) {
166 switch (eventType) {
167 case 'basic':
168 reportWebsiteEvent('Tianji Demo Event (Batch)');
169 break;
170 case 'pageview':
171 const pages = [
172 '/home',
173 '/about',
174 '/products',
175 '/blog',
176 '/contact',
177 '/pricing',
178 '/features',
179 '/docs',
180 '/support',
181 '/login',
182 '/signup',
183 '/dashboard',
184 '/profile',
185 '/settings',
186 '/search',
187 '/api',
188 '/help',
189 '/terms',
190 '/privacy',
191 '/news',
192 '/events',
193 '/careers',
194 '/team',
195 '/partners',
196 ];
197 const referrers = [
198 'https://google.com',
199 'https://twitter.com',
200 'https://facebook.com',
201 'https://linkedin.com',
202 'https://github.com',
203 'direct',
204 'https://reddit.com',
205 'https://youtube.com',
206 'https://bing.com',
207 'https://duckduckgo.com',
208 'https://yahoo.com',

Callers 1

HomeFunction · 0.85

Calls 6

reportWebsiteEventFunction · 0.85
sendPageViewFunction · 0.85
identifyWebsiteUserFunction · 0.85
incrementEventCountFunction · 0.85
nowMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected