Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat(landing): track label button clicks BM-1066 #3335

Merged
merged 2 commits into from
Aug 26, 2024
Merged
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
2 changes: 2 additions & 0 deletions packages/lambda-tiler/src/routes/tile.style.json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,8 @@ export async function styleJsonGet(req: LambdaHttpRequest<StyleGet>): Promise<La
const dbId = config.Style.id(styleName);
const styleConfig = await config.Style.get(dbId);

req.set('styleConfig', { terrain, labels });

if (styleConfig == null) {
// Were we given a tileset name instead, generated
const tileSet = await config.TileSet.get(config.TileSet.id(styleName));
Expand Down
6 changes: 4 additions & 2 deletions packages/landing/src/components/map.label.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { IControl } from 'maplibre-gl';

import { Config } from '../config.js';
import { Config, GaEvent, gaEvent } from '../config.js';

const LabelsDisabledLayers = new Set(['topographic', 'topolite']);

Expand Down Expand Up @@ -42,7 +42,9 @@ export class MapLabelControl implements IControl {
}

toggleLabels = (): void => {
Config.map.setLabels(!Config.map.labels);
const labelState = !Config.map.labels;
gaEvent(GaEvent.Ui, `labels:${labelState}`);
Config.map.setLabels(labelState);
};

updateLabelIcon = (): void => {
Expand Down
Loading