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

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

Merged
merged 5 commits into from
Jan 16, 2023

Conversation

matus-tomlein
Copy link
Contributor

@matus-tomlein matus-tomlein commented Dec 22, 2022

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.

@matus-tomlein matus-tomlein changed the base branch from master to release/3.8.0 December 22, 2022 14:41
@bundlemon
Copy link

bundlemon bot commented Dec 22, 2022

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
@matus-tomlein matus-tomlein force-pushed the issue/1133-focalmeter branch from fa4fff4 to 18434f6 Compare January 9, 2023 08:02
return `sp-fclmtr-${trackerId}`;
}

function sendRequest(url: string, userId: string, LOG: Logger, successCallback: () => void): void {
Copy link
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 changed the base branch from master to release/3.9.0-beta.1 January 16, 2023 10:57
@matus-tomlein matus-tomlein merged commit bafe1bf into release/3.9.0-beta.1 Jan 16, 2023
@matus-tomlein matus-tomlein deleted the issue/1133-focalmeter branch January 16, 2023 10:57
greg-el pushed a commit that referenced this pull request Mar 2, 2023
igneel64 pushed a commit that referenced this pull request May 9, 2023
greg-el pushed a commit that referenced this pull request May 26, 2023
me-marcel pushed a commit to me-marcel/snowplow-javascript-tracker that referenced this pull request Jul 3, 2023
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 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants