Skip to content

Commit

Permalink
feature(ConvertFlow): updating properties
Browse files Browse the repository at this point in the history
  • Loading branch information
ujjwal-ab committed Aug 16, 2022
1 parent b74c956 commit 70e2abc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
6 changes: 3 additions & 3 deletions integrations/ConvertFlow/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ class ConvertFlow {
"convertflow-integration",
`https://js.convertflow.co/production/websites/${this.websiteId}.js`
);
if (this.toggleToSendData) {
this.trigger();
}
}

isLoaded() {
logger.debug("===In isLoaded convertflow===");
if (this.toggleToSendData) {
this.trigger();
}
return !!window.convertflow && typeof window.convertflow === "object";
}

Expand Down
28 changes: 21 additions & 7 deletions integrations/ConvertFlow/utils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { getHashFromArray } from "../utils/commonUtils";
import {
getHashFromArray,
isDefinedAndNotNullAndNotEmpty,
} from "../utils/commonUtils";

// default mapping for the events
const standardEventsListMapping = {
Expand All @@ -25,12 +28,23 @@ const makeACall = (standardEventsMap, eventName, data) => {
updatedEvent = event;
}
});
if (data && data.cta) {
window.rudderanalytics.track(updatedEvent, {
name: data.cta.name,
cta_type: data.cta.cta_type,
id: data.cta.id,
});
const properties = {};
if (data) {
if (data.cta) {
const { cta } = data;
properties.cta_name = cta.name;
properties.cta_type = cta.cta_type;
properties.cta_id = cta.id;
}
if (data.variant) {
properties.cta_variant = data.variant.variation;
}
if (data.step) {
properties.cta_step = data.step.position;
}
}
if (isDefinedAndNotNullAndNotEmpty(properties)) {
window.rudderanalytics.track(updatedEvent, properties);
} else {
window.rudderanalytics.track(updatedEvent);
}
Expand Down

0 comments on commit 70e2abc

Please sign in to comment.