aboutsummaryrefslogtreecommitdiff
path: root/scripts/seed/sites/blog.ts
blob: e60b8b95eede12747d6bbf0504b5031f2d759e95 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
import { weightedRandom, type WeightedOption } from '../utils.js';
import type {
  SiteConfig,
  JourneyConfig,
  PageConfig,
  CustomEventConfig,
} from '../generators/events.js';

export const BLOG_WEBSITE_NAME = 'Demo Blog';
export const BLOG_WEBSITE_DOMAIN = 'blog.example.com';

const blogPosts = [
  'getting-started-with-analytics',
  'privacy-first-tracking',
  'understanding-your-visitors',
  'improving-page-performance',
  'seo-best-practices',
  'content-marketing-guide',
  'building-audience-trust',
  'data-driven-decisions',
];

export const blogPages: PageConfig[] = [
  { path: '/', title: 'Demo Blog - Home', weight: 0.25, avgTimeOnPage: 30 },
  { path: '/blog', title: 'Blog Posts', weight: 0.2, avgTimeOnPage: 45 },
  { path: '/about', title: 'About Us', weight: 0.1, avgTimeOnPage: 60 },
  { path: '/contact', title: 'Contact', weight: 0.05, avgTimeOnPage: 45 },
  ...blogPosts.map(slug => ({
    path: `/blog/${slug}`,
    title: slug
      .split('-')
      .map(w => w.charAt(0).toUpperCase() + w.slice(1))
      .join(' '),
    weight: 0.05,
    avgTimeOnPage: 180,
  })),
];

export const blogJourneys: JourneyConfig[] = [
  // Direct to blog post (organic search)
  { pages: ['/blog/getting-started-with-analytics'], weight: 0.15 },
  { pages: ['/blog/privacy-first-tracking'], weight: 0.12 },
  { pages: ['/blog/understanding-your-visitors'], weight: 0.1 },

  // Homepage bounces
  { pages: ['/'], weight: 0.15 },

  // Homepage to blog listing
  { pages: ['/', '/blog'], weight: 0.1 },

  // Homepage to blog post
  { pages: ['/', '/blog', '/blog/seo-best-practices'], weight: 0.08 },
  { pages: ['/', '/blog', '/blog/content-marketing-guide'], weight: 0.08 },

  // About page visits
  { pages: ['/', '/about'], weight: 0.07 },
  { pages: ['/', '/about', '/contact'], weight: 0.05 },

  // Blog post to another
  { pages: ['/blog/improving-page-performance', '/blog/data-driven-decisions'], weight: 0.05 },

  // Longer sessions
  { pages: ['/', '/blog', '/blog/building-audience-trust', '/about'], weight: 0.05 },
];

export const blogCustomEvents: CustomEventConfig[] = [
  {
    name: 'newsletter_signup',
    weight: 0.03,
    pages: ['/', '/blog'],
  },
  {
    name: 'share_click',
    weight: 0.05,
    pages: blogPosts.map(slug => `/blog/${slug}`),
    data: {
      platform: ['twitter', 'linkedin', 'facebook', 'copy_link'],
    },
  },
  {
    name: 'scroll_depth',
    weight: 0.2,
    pages: blogPosts.map(slug => `/blog/${slug}`),
    data: {
      depth: [25, 50, 75, 100],
    },
  },
];

export function getBlogSiteConfig(): SiteConfig {
  return {
    hostname: BLOG_WEBSITE_DOMAIN,
    pages: blogPages,
    journeys: blogJourneys,
    customEvents: blogCustomEvents,
  };
}

export function getBlogJourney(): string[] {
  const journeyWeights: WeightedOption<string[]>[] = blogJourneys.map(j => ({
    value: j.pages,
    weight: j.weight,
  }));

  return weightedRandom(journeyWeights);
}

export const BLOG_SESSIONS_PER_DAY = 3; // ~90 sessions per month