Skip to content

Commit

Permalink
feat(landing): track label button clicks BM-1066 (#3335)
Browse files Browse the repository at this point in the history
### Motivation

It would be nice to know how people are asking for layers to be rendered
with labels enabled

### Modifications

Track users clicking on labels
Track styleJsons being created with labels enabled

### Verification

Will check google analytics after deployed.
  • Loading branch information
blacha authored Aug 26, 2024
1 parent 49524c0 commit 555f8b5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
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

0 comments on commit 555f8b5

Please sign in to comment.