Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Incorporate Google Analytics #251

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
148 changes: 124 additions & 24 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,70 @@ import { defineConfig, squooshImageService } from "astro/config";
import starlight from "@astrojs/starlight";
import solidJs from "@astrojs/solid-js";
import react from "@astrojs/react";
import starlightLinksValidator from 'starlight-links-validator';
import starlightLinksValidator from "starlight-links-validator";
import sitemap from "@astrojs/sitemap";
import partytown from "@astrojs/partytown";

// https://astro.build/config
export default defineConfig({
site: 'https://splashkit.io/',
site: "https://splashkit.io/",
// base: '/splashkit.io-starlight', // if hosted without domain.
// output: "server",
// adapter: netlify(),
integrations: [
partytown({
config: {
forward: ["dataLayer.push", "gtag"], // Forward both for compatibility
},
}),
starlight({
title: "SplashKit",
description: 'SplashKit is a cross-platform game engine for C, C++ and Objective-C. It provides a simple API for 2D game development.',
description:
"SplashKit is a cross-platform game engine for C, C++ and Objective-C. It provides a simple API for 2D game development.",
head: [
// Google Analytics script tag
{
tag: "script",
attrs: {
type: "text/partytown",
src: "https://www.googletagmanager.com/gtag/js?id=G-1HKE1PH6ZM",
async: true,
},
},
// Google Analytics inline configuration
{
tag: "script",
type: "text/partytown",
innerHTML: `
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('consent', 'default', {
ad_storage: 'denied',
ad_user_data: 'denied',
ad_personalization: 'denied',
analytics_storage: 'granted',
});
gtag('config', 'G-1HKE1PH6ZM');
`,
},
// CookieConsent stylesheet
{
tag: "link",
attrs: {
rel: "stylesheet",
href: "https://cdn.jsdelivr.net/gh/orestbida/cookieconsent@3.0.1/dist/cookieconsent.css",
},
},
// CookieConsent configuration script
{
tag: "script",
attrs: {
type: "module",
src: "/cookieconsent-config.js", // Ensure this script exists in the `public/` folder
},
},
],
plugins: [
starlightLinksValidator({
errorOnRelativeLinks: true,
Expand All @@ -25,18 +76,17 @@ export default defineConfig({
// frames: {
// showCopyToClipboardButton: true,
// },
styleOverrides: { borderRadius: '0.5rem' },
styleOverrides: { borderRadius: "0.5rem" },
useDarkModeMediaQuery: true,
},
customCss: [

"/src/styles/custom.css",
"/src/styles/background.css",
"/src/styles/cards.css",
],
social: {
github: "https://github.com/splashkit",
youtube: 'https://www.youtube.com/@splashkit7674'
youtube: "https://www.youtube.com/@splashkit7674",
},
favicon: "/images/favicon.svg",
logo: {
Expand All @@ -63,7 +113,6 @@ export default defineConfig({
collapsed: true,
autogenerate: { directory: "troubleshoot", collapsed: true },
badge: "New",

},
{
label: "Developer Documentation",
Expand All @@ -74,20 +123,71 @@ export default defineConfig({
collapsed: true,
items: [
{ label: "Overview", link: "guides/" },
{ label: "Using SplashKit", autogenerate: { directory: "guides/Using-SplashKit", collapsed: false } },
{ label: "Animations", autogenerate: { directory: "guides/Animations", collapsed: false } },
{ label: "Audio", autogenerate: { directory: "guides/Audio", collapsed: false } },
{ label: "Camera", autogenerate: { directory: "guides/Camera", collapsed: false } },
{ label: "Graphics", autogenerate: { directory: "guides/Graphics", collapsed: false } },
{ label: "Input", autogenerate: { directory: "guides/Input", collapsed: false } },
{ label: "Interface", autogenerate: { directory: "guides/Interface", collapsed: false } },
{ label: "Json", autogenerate: { directory: "guides/JSON", collapsed: false } },
{ label: "Networking", autogenerate: { directory: "guides/Networking", collapsed: false } },
{ label: "Raspberry GPIO", autogenerate: { directory: "guides/Raspberry-GPIO", collapsed: false } },
{ label: "Resource Bundles", autogenerate: { directory: "guides/Resource-Bundles", collapsed: false } },
{
label: "Using SplashKit",
autogenerate: {
directory: "guides/Using-SplashKit",
collapsed: false,
},
},
{
label: "Animations",
autogenerate: {
directory: "guides/Animations",
collapsed: false,
},
},
{
label: "Audio",
autogenerate: { directory: "guides/Audio", collapsed: false },
},
{
label: "Camera",
autogenerate: { directory: "guides/Camera", collapsed: false },
},
{
label: "Graphics",
autogenerate: { directory: "guides/Graphics", collapsed: false },
},
{
label: "Input",
autogenerate: { directory: "guides/Input", collapsed: false },
},
{
label: "Interface",
autogenerate: { directory: "guides/Interface", collapsed: false },
},
{
label: "Json",
autogenerate: { directory: "guides/JSON", collapsed: false },
},
{
label: "Networking",
autogenerate: {
directory: "guides/Networking",
collapsed: false,
},
},
{
label: "Raspberry GPIO",
autogenerate: {
directory: "guides/Raspberry-GPIO",
collapsed: false,
},
},
{
label: "Resource Bundles",
autogenerate: {
directory: "guides/Resource-Bundles",
collapsed: false,
},
},
// { label: "Sprites", autogenerate: { directory: "guides/Sprites", collapsed: false } },
{ label: "Utilities", autogenerate: { directory: "guides/Utilities", collapsed: false } },
]
{
label: "Utilities",
autogenerate: { directory: "guides/Utilities", collapsed: false },
},
],
// autogenerate: { directory: "guides", collapsed: true },
},
{
Expand All @@ -99,16 +199,16 @@ export default defineConfig({
// autogenerate: { directory: "arcade-hackathon-project", collapsed: true },
// },
],

}),

solidJs(), sitemap()
solidJs(),
sitemap(),
],

// Process images with sharp: https://docs.astro.build/en/guides/assets/#using-sharp
image: { service: squooshImageService() },
server: {
host: true,
port: 4322
}
port: 4322,
},
});
39 changes: 35 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
},
"dependencies": {
"@astrojs/netlify": "^5.4.0",
"@astrojs/partytown": "^2.1.2",
"@astrojs/prism": "^3.1.0",
"@astrojs/react": "^3.6.0",
"@astrojs/sitemap": "^3.1.6",
Expand Down Expand Up @@ -42,7 +43,8 @@
"squoosh": "0.0.0",
"starlight-links-validator": "0.10.1",
"swiper": "11.1.3",
"tailwindcss": "3.4.3"
"tailwindcss": "3.4.3",
"vanilla-cookieconsent": "^3.0.1"
},
"devDependencies": {
"accessible-astro-components": "2.3.6"
Expand Down
Loading