Skip to content

Commit

Permalink
instrumentation tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
CollinSchneider committed Apr 22, 2024
1 parent 4ab582c commit 392f857
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,8 @@ def pre_existing_user_profile_for_provided_user_data
@pre_existing_user_profile_for_provided_user_data ||= begin
return if !provided_unique_user_identifier.present? && !provided_user_properties['email'].present?
profile_by_identifier = workspace.analytics_user_profiles.find_by(user_unique_identifier: provided_unique_user_identifier)
return profile_by_identifier if profile_by_identifier.present?
profile_by_email = provided_user_properties['email'].present? && workspace.analytics_user_profiles.find_by(user_unique_identifier: nil, email: provided_user_properties['email'])
return profile_by_email if profile_by_email.present?
return profile_by_identifier if profile_by_identifier.present? || provided_user_properties['email'].blank?
workspace.analytics_user_profiles.find_by(user_unique_identifier: nil, email: provided_user_properties['email'])
end
end

Expand Down
2 changes: 1 addition & 1 deletion sdk/client/cdn/build.js

Large diffs are not rendered by default.

13 changes: 7 additions & 6 deletions sdk/client/cdn/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ import Swishjam from '@swishjam/core';
const apiEndpoint = document.currentScript.getAttribute('data-api-endpoint');
const apiHost = document.currentScript.getAttribute('data-api-host');
const apiPath = document.currentScript.getAttribute('data-api-path');
const autoIdentify = document.currentScript.getAttribute('data-auto-identify') === 'true';
const disabledUrls = (document.currentScript.getAttribute('data-disabled-urls') || '').split(',');
const includedUrlParams = (document.currentScript.getAttribute('data-included-url-params') || '').split(',');
const autoIdentify = document.currentScript.getAttribute('data-auto-identify') !== 'false';
const disabledUrls = (document.currentScript.getAttribute('data-disabled-urls') || '').split(',').filter(Boolean);
const includedUrlParams = (document.currentScript.getAttribute('data-included-url-params') || '').split(',').filter(Boolean);
const maxEventsInMemory = document.currentScript.getAttribute('data-max-events-in-memory');
const recordClicks = document.currentScript.getAttribute('data-record-clicks') === 'true';
const recordFormSubmits = document.currentScript.getAttribute('data-record-form-submits') === 'true';
const recordClicks = document.currentScript.getAttribute('data-record-clicks') !== 'false';
const recordFormSubmits = document.currentScript.getAttribute('data-record-form-submits') !== 'false';
const reportingHeartbeatMs = document.currentScript.getAttribute('data-reporting-heartbeat-ms');
const sessionTimeoutMinutes = document.currentScript.getAttribute('data-session-timeout-minutes');
const useSegment = document.currentScript.getAttribute('data-use-segment') === 'true';
// making segment opt-out for CDN, it's opt-in for the core SDK
const useSegment = document.currentScript.getAttribute('data-use-segment') !== 'false';

if (!apiKey) throw new Error('Missing Swishjam API key, you must provide it in the `data-api-key` attribute of the Swishjam CDN script tag.');
new Swishjam({
Expand Down
18 changes: 9 additions & 9 deletions sdk/client/cdn/package-lock.json

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

4 changes: 2 additions & 2 deletions sdk/client/cdn/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@swishjam/cdn",
"version": "0.0.301",
"version": "0.0.502",
"description": "",
"main": "build.js",
"scripts": {
Expand All @@ -11,7 +11,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"@swishjam/core": "^0.0.401"
"@swishjam/core": "^0.0.5"
},
"devDependencies": {
"@babel/core": "^7.22.15",
Expand Down

0 comments on commit 392f857

Please sign in to comment.