Skip to content

Add plugin to send requests with user ID to a Kantar FocalMeter endpoint (close #1133) - #1134

Merged
Matus Tomlein (matus-tomlein) merged 5 commits into
release/3.9.0-beta.1from
issue/1133-focalmeter
Jan 16, 2023
Merged

Add plugin to send requests with user ID to a Kantar FocalMeter endpoint (close #1133)#1134
Matus Tomlein (matus-tomlein) merged 5 commits into
release/3.9.0-beta.1from
issue/1133-focalmeter

Conversation

@matus-tomlein

@matus-tomlein Matus Tomlein (matus-tomlein) commented Dec 22, 2022

Copy link
Copy Markdown
Contributor

Issue #1133

Implements a plugin for integration with Kantar FocalMeter system for measuring audience of content using a router on local network.

The solution works by sending an HTTP request with the current domain user ID to a configurable Kantar endpoint. This enables the FocalMeter to associate the traffic from the device with the Snowplow ID.

The request is made from a plugin in the afterTrack callback. It checks whether the user ID in the trackerd event changed from the last observed one and if so, it makes the request. The Kantar endpoint to make the request to is passed when creating the plugin.

There is also an option to store the last observed user ID in local storage so that the same request doesn't need to be made on each page load. However, I decided to make the local storage disabled by default because I assume that sometimes it is necessary to make the request with the ID multiple times. For example, in case one loads the page in a place where they don't have the Kantar router but then go to a different place with the router, we should make the request in the second place as well.

@bundlemon

bundlemon Bot commented Dec 22, 2022

Copy link
Copy Markdown

BundleMon

Files added (6)
Status Path Size Limits
libraries/browser-tracker-core/dist/index.mod
ule.js
+23.8KB 25KB / +10%
trackers/javascript-tracker/dist/sp.js
+23.49KB 25KB / +10%
trackers/javascript-tracker/dist/sp.lite.js
+14.2KB 15KB / +10%
trackers/browser-tracker/dist/index.umd.min.j
s
+14.05KB 15KB / +10%
libraries/tracker-core/dist/index.module.js
+13.35KB 15KB / +10%
trackers/browser-tracker/dist/index.module.js
+3.46KB 5KB / +10%

Total files change +92.34KB 0%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history

Base automatically changed from release/3.8.0 to master January 3, 2023 15:34
Comment thread plugins/browser-plugin-focalmeter/src/index.ts Outdated
Comment thread plugins/browser-plugin-focalmeter/package.json Outdated
return `sp-fclmtr-${trackerId}`;
}

function sendRequest(url: string, userId: string, LOG: Logger, successCallback: () => void): void {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point this should be extracted (just leaving the comment here as a thought moving forward)

@matus-tomlein
Matus Tomlein (matus-tomlein) changed the base branch from master to release/3.9.0-beta.1 January 16, 2023 10:57
@matus-tomlein
Matus Tomlein (matus-tomlein) merged commit bafe1bf into release/3.9.0-beta.1 Jan 16, 2023
@matus-tomlein
Matus Tomlein (matus-tomlein) deleted the issue/1133-focalmeter branch January 16, 2023 10:57
Matus Tomlein (matus-tomlein) added a commit that referenced this pull request Jul 10, 2023
…int (close #1133)

PR #1134
# Conflicts:
#	common/config/rush/pnpm-lock.yaml
#	common/config/rush/repo-state.json
#	rush.json
Matus Tomlein (matus-tomlein) added a commit that referenced this pull request Oct 5, 2023
…int (close #1133)

PR #1134
# Conflicts:
#	common/config/rush/pnpm-lock.yaml
#	common/config/rush/repo-state.json
#	rush.json

# Conflicts:
#	common/config/rush/pnpm-lock.yaml
#	common/config/rush/repo-state.json
#	rush.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants