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

master <-- npm staging #230

Merged
merged 53 commits into from
Mar 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
57798ee
make release of cdn version 1.1.12
sayan-mitra Feb 8, 2021
0a43ad8
Merge pull request #203 from rudderlabs/production-staging
sayan-mitra Feb 8, 2021
49211f7
Add "getSourceConfig" option as an alternative to "configUrl" to get …
gassiss Feb 22, 2021
af176ba
Build NPM and add dist folder
gassiss Feb 22, 2021
b216fcb
klaviyo device mode onboarding
utsabc Feb 23, 2021
ffec339
klaviyo update
utsabc Feb 24, 2021
1facad3
klaviyo review comment fixes
utsabc Feb 24, 2021
5b0b2aa
minor fix
utsabc Feb 24, 2021
5193d31
Merge pull request #210 from gassiss/add-fn-to-fetch-source-config
sayan-mitra Feb 24, 2021
07b958c
Merge branch 'production' into production-staging-merge
sayan-mitra Feb 24, 2021
62af828
page call fixes
utsabc Feb 24, 2021
0201860
update gitignore and autotrack
sayan-mitra Feb 24, 2021
a759adc
remove untracked files
sayan-mitra Feb 24, 2021
26fcd65
Merge pull request #211 from rudderlabs/production-staging-merge
sayan-mitra Feb 24, 2021
fc5547a
reverting check for traits in message root
utsabc Feb 24, 2021
148d525
store initial referrer and referring domain and add in payload
prabrishac Feb 25, 2021
315e8e3
Merge pull request #213 from rudderlabs/feature/init_page_properties
sayan-mitra Feb 25, 2021
3fcfe09
klaviyo review comment fixes
utsabc Feb 25, 2021
621b1e8
minor fix
utsabc Feb 25, 2021
8a01073
review changes minor
utsabc Feb 26, 2021
634b930
resolving conflict
utsabc Feb 26, 2021
f0ded9c
Merge pull request #212 from rudderlabs/klaviyo-integration
sayan-mitra Mar 1, 2021
bd6fe6d
added babel transform plugin for object assign
prabrishac Mar 3, 2021
e9f5eaa
Merge pull request #214 from rudderlabs/fix/transform_object_assign
sayan-mitra Mar 3, 2021
cfeb2cc
klaviyo - minor fixes
utsabc Mar 4, 2021
66ee347
added util fxn
utsabc Mar 4, 2021
377e34b
fixes
utsabc Mar 4, 2021
a09abf8
Merge pull request #215 from rudderlabs/klaviyo-integration
sayan-mitra Mar 4, 2021
c75e142
bug
utsabc Mar 4, 2021
dea9fd2
Merge pull request #217 from rudderlabs/klaviyo-integration
sayan-mitra Mar 4, 2021
ce7a349
onboarding clevertap
utsabc Mar 8, 2021
15d1530
klaviyo support of email as primary
utsabc Mar 8, 2021
ba761fa
Merge pull request #218 from rudderlabs/klaviyo-integration
sayan-mitra Mar 8, 2021
e837e04
device mode support for page call aswell
utsabc Mar 8, 2021
475886d
bump version
sayan-mitra Mar 9, 2021
cd128f3
Merge pull request #216 from rudderlabs/production-staging
sayan-mitra Mar 9, 2021
4d3bfd1
addressed review comments
utsabc Mar 12, 2021
c3dc1e7
fix for util fxns
utsabc Mar 17, 2021
9dfa286
Merge pull request #219 from rudderlabs/clevertap
sayan-mitra Mar 17, 2021
474653d
pull changes from other PR and changes to storage
sayan-mitra Mar 17, 2021
1d18766
pull changes from other PR and changes to storage
sayan-mitra Mar 17, 2021
d1b7902
bump version
sayan-mitra Mar 17, 2021
43dcc8a
Merge pull request #221 from rudderlabs/cookie-domain
prabrishac Mar 17, 2021
fa5f42c
Merge pull request #223 from rudderlabs/custom-domain
sayan-mitra Mar 17, 2021
cea2f5d
post test fixes
utsabc Mar 18, 2021
815d29a
minor util fix
utsabc Mar 18, 2021
1da3199
Merge pull request #225 from rudderlabs/clevertap-testfixes
prabrishac Mar 18, 2021
b93cb60
legacy support fixes
utsabc Mar 22, 2021
59e6579
Merge pull request #227 from rudderlabs/clevertap-testfixes
sayan-mitra Mar 22, 2021
1b590aa
Update package.json
sayan-mitra Mar 22, 2021
087d365
Merge branch 'production' into production-staging
sayan-mitra Mar 22, 2021
b396b64
Merge pull request #222 from rudderlabs/production-staging
sayan-mitra Mar 22, 2021
e03d983
add dist files
sayan-mitra Mar 24, 2021
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
3 changes: 2 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"loose": true
}
],
["@babel/plugin-transform-arrow-functions"]
["@babel/plugin-transform-arrow-functions"],
["@babel/plugin-transform-object-assign"]
]
}
55 changes: 50 additions & 5 deletions analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ import {
findAllEnabledDestinations,
tranformToRudderNames,
transformToServerNames,
checkReservedKeywords
checkReservedKeywords,
getReferrer,
getReferringDomain
} from "./utils/utils";
import {
CONFIG_URL,
Expand Down Expand Up @@ -126,6 +128,17 @@ class Analytics {
this.storage.setGroupTraits(this.groupTraits);
}

setInitialPageProperties(){
let initialReferrer = this.storage.getInitialReferrer();
let initialReferringDomain = this.storage.getInitialReferringDomain();
if(initialReferrer == null && initialReferringDomain == null){
initialReferrer = getReferrer();
initialReferringDomain = getReferringDomain(initialReferrer);
this.storage.setInitialReferrer(initialReferrer);
this.storage.setInitialReferringDomain(initialReferringDomain);
}
}

/**
* Process the response from control plane and
* call initialize for integrations
Expand All @@ -137,7 +150,9 @@ class Analytics {
processResponse(status, response) {
try {
logger.debug(`===in process response=== ${status}`);
response = JSON.parse(response);
if (typeof response === 'string') {
response = JSON.parse(response);
}
if (
response.source.useAutoTracking &&
!this.autoTrackHandlersRegistered
Expand Down Expand Up @@ -794,6 +809,8 @@ class Analytics {
getPageProperties(properties, options) {
const defaultPageProperties = getDefaultPageProperties();
const optionPageProperties = options && options.page ? options.page : {};
defaultPageProperties.initial_referrer = this.storage.getInitialReferrer();
defaultPageProperties.initial_referring_domain = this.storage.getInitialReferringDomain();
for (const key in defaultPageProperties) {
if (properties[key] === undefined) {
properties[key] =
Expand Down Expand Up @@ -903,6 +920,9 @@ class Analytics {
if (options && options.logLevel) {
logger.setLogLevel(options.logLevel);
}
if (options && options.setCookieDomain) {
this.storage.options({domain: options.setCookieDomain});
}
if (options && options.integrations) {
Object.assign(this.loadOnlyIntegrations, options.integrations);
tranformToRudderNames(this.loadOnlyIntegrations);
Expand Down Expand Up @@ -959,6 +979,7 @@ class Analytics {
this.eventRepository.url = serverUrl;
}
this.initializeUser();
this.setInitialPageProperties();
this.loaded = true;
if (
options &&
Expand All @@ -978,14 +999,38 @@ class Analytics {
);
}
}
try {
getJSONTrimmed(this, configUrl, writeKey, this.processResponse);
} catch (error) {

function errorHandler(error) {
handleError(error);
if (this.autoTrackFeatureEnabled && !this.autoTrackHandlersRegistered) {
addDomEventHandlers(this);
}
}

if (options && options.getSourceConfig) {
if (typeof options.getSourceConfig !== "function") {
handleError('option "getSourceConfig" must be a function');
} else {
const res = options.getSourceConfig();

if (res instanceof Promise) {
res
.then(res => this.processResponse(200, res))
.catch(errorHandler)
} else {
this.processResponse(200, res);
}

processDataInAnalyticsArray(this);
}
return;
}

try {
getJSONTrimmed(this, configUrl, writeKey, this.processResponse);
} catch (error) {
errorHandler(error)
}
processDataInAnalyticsArray(this);
}

Expand Down
1 change: 0 additions & 1 deletion dist/rudder-sdk-js/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,3 @@ declare module "rudder-sdk-js" {
getAnonymousId
}
}

2 changes: 1 addition & 1 deletion dist/rudder-sdk-js/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
<body>
<p>HI..</p>
</body>
</html>
</html>
Loading