Skip to content

Commit

Permalink
chore(release): pull main into develop post release v1.71.0 (#3542)
Browse files Browse the repository at this point in the history
  • Loading branch information
utsabc authored Jul 11, 2024
2 parents 2eb92e3 + 9ea8a35 commit 4235a7b
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 30 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,26 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [1.71.1](https://github.com/rudderlabs/rudder-transformer/compare/v1.71.0...v1.71.1) (2024-07-10)


### Bug Fixes

* ga4 v2 userproperties ([#3544](https://github.com/rudderlabs/rudder-transformer/issues/3544)) ([bc7b886](https://github.com/rudderlabs/rudder-transformer/commit/bc7b886fd314f35b5b5573989d8f094b7ba0321f))
* tiktok: remove default value for content type for all events ([#3545](https://github.com/rudderlabs/rudder-transformer/issues/3545)) ([0ca08c3](https://github.com/rudderlabs/rudder-transformer/commit/0ca08c3fe8e4d53f92ce16eccd1f60224e1f1409))

## [1.71.0](https://github.com/rudderlabs/rudder-transformer/compare/v1.70.1...v1.71.0) (2024-07-08)


### Features

* onboard new custom destination: wunderkind ([#3456](https://github.com/rudderlabs/rudder-transformer/issues/3456)) ([7f49a01](https://github.com/rudderlabs/rudder-transformer/commit/7f49a01b04322a38c5f96199d21097a9210e80fc))


### Bug Fixes

* zapier event lower case issue ([#3535](https://github.com/rudderlabs/rudder-transformer/issues/3535)) ([277c1f0](https://github.com/rudderlabs/rudder-transformer/commit/277c1f00606b0ec5974e6bf24dae6749a1679069))

### [1.70.1](https://github.com/rudderlabs/rudder-transformer/compare/v1.70.0...v1.70.1) (2024-07-03)

### Bug Fixes
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rudder-transformer",
"version": "1.70.1",
"version": "1.71.1",
"description": "",
"homepage": "https://github.com/rudderlabs/rudder-transformer#readme",
"bugs": {
Expand Down
24 changes: 10 additions & 14 deletions src/v0/destinations/ga4/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -554,21 +554,17 @@ const buildDeliverablePayload = (payload, Config) => {
return response;
};

const sanitizeUserProperties = (userProperties) => {
Object.keys(userProperties).forEach((key) => {
const propetyValue = userProperties[key];
if (
typeof propetyValue === 'string' ||
typeof propetyValue === 'number' ||
typeof propetyValue === 'boolean'
) {
delete userProperties[key];
userProperties[key] = {
value: propetyValue,
};
function sanitizeUserProperties(userPropertiesObj) {
const sanitizedObj = {};
// eslint-disable-next-line no-restricted-syntax, guard-for-in
for (const key in userPropertiesObj) {
const { value } = userPropertiesObj[key];
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
sanitizedObj[key] = { value };
}
});
};
}
return sanitizedObj;
}

const basicConfigvalidaiton = (Config) => {
if (!Config.typesOfClient) {
Expand Down
6 changes: 6 additions & 0 deletions src/v0/destinations/ga4_v2/customMappingsHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const {
buildDeliverablePayload,
GA4_PARAMETERS_EXCLUSION,
prepareUserProperties,
sanitizeUserProperties,
} = require('../ga4/utils');
const { InstrumentationError } = require('@rudderstack/integrations-lib');
const {
Expand Down Expand Up @@ -158,6 +159,11 @@ const boilerplateOperations = (ga4Payload, message, Config, eventName) => {
if (!isEmptyObject(consents)) {
ga4Payload.consent = consents;
}

// Prepare GA4 user properties
if (isDefinedAndNotNull(ga4Payload.user_properties)) {
ga4Payload.user_properties = sanitizeUserProperties(ga4Payload.user_properties);
}
};

module.exports = {
Expand Down
4 changes: 4 additions & 0 deletions src/v0/destinations/tiktok_ads/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ const mappingConfig = getMappingConfig(ConfigCategory, __dirname);
// tiktok docs for max batch size for events 2.0: https://business-api.tiktok.com/portal/docs?id=1771100779668482
const maxBatchSizeV2 = 1000;
const trackEndpointV2 = 'https://business-api.tiktok.com/open_api/v1.3/event/track/';
// Following is the list of standard events for which some parameters are recommended
// Ref: https://business-api.tiktok.com/portal/docs?id=1771101186666498
const eventsWithRecommendedParams = ['AddToCart', 'CompletePayment', 'PlaceAnOrder', 'ViewContent'];
module.exports = {
TRACK_ENDPOINT,
BATCH_ENDPOINT,
Expand All @@ -50,4 +53,5 @@ module.exports = {
DESTINATION: 'TIKTOK_ADS',
trackEndpointV2,
maxBatchSizeV2,
eventsWithRecommendedParams,
};
25 changes: 21 additions & 4 deletions src/v0/destinations/tiktok_ads/transformV2.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@ const {
const { getContents, hashUserField } = require('./util');
const config = require('./config');

const { trackMappingV2, trackEndpointV2, eventNameMapping, PARTNER_NAME } = config;
const {
trackMappingV2,
trackEndpointV2,
eventNameMapping,
PARTNER_NAME,
eventsWithRecommendedParams,
} = config;
const { JSON_MIME_TYPE } = require('../../util/constant');

/**
Expand Down Expand Up @@ -94,7 +100,14 @@ const trackResponseBuilder = async (message, { Config }) => {
Object.keys(standardEventsMap).forEach((key) => {
if (key === event) {
standardEventsMap[event].forEach((eventName) => {
responseList.push(getTrackResponsePayload(message, Config, eventName));
responseList.push(
getTrackResponsePayload(
message,
Config,
eventName,
eventsWithRecommendedParams.includes(eventName),
),
);
});
}
});
Expand All @@ -105,11 +118,15 @@ const trackResponseBuilder = async (message, { Config }) => {
Doc https://ads.tiktok.com/help/article/standard-events-parameters?lang=en
*/
event = message.event;
responseList.push(getTrackResponsePayload(message, Config, event, false));
responseList.push(
getTrackResponsePayload(message, Config, event, eventsWithRecommendedParams.includes(event)),
);
} else {
// incoming event name is already a standard event name
event = eventNameMapping[event];
responseList.push(getTrackResponsePayload(message, Config, event));
responseList.push(
getTrackResponsePayload(message, Config, event, eventsWithRecommendedParams.includes(event)),
);
}
// set event source and event_source_id
response.body.JSON = {
Expand Down
7 changes: 0 additions & 7 deletions test/integrations/destinations/tiktok_ads/processor/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5385,7 +5385,6 @@ export const data = [
event_id: '1616318632825_357',
event_time: 1600372167,
properties: {
content_type: 'product',
contents: [
{
price: 8,
Expand Down Expand Up @@ -5550,7 +5549,6 @@ export const data = [
event_id: '1616318632825_357',
event_time: 1600372167,
properties: {
content_type: 'product',
contents: [
{
price: 8,
Expand Down Expand Up @@ -5586,7 +5584,6 @@ export const data = [
event_id: '1616318632825_357',
event_time: 1600372167,
properties: {
content_type: 'product',
contents: [
{
price: 8,
Expand Down Expand Up @@ -5745,7 +5742,6 @@ export const data = [
event_id: '1616318632825_357',
event_time: 1600372167,
properties: {
content_type: 'product',
contents: [
{
price: 8,
Expand Down Expand Up @@ -5784,7 +5780,6 @@ export const data = [
event_id: '1616318632825_357',
event_time: 1600372167,
properties: {
content_type: 'product',
contents: [
{
price: 8,
Expand Down Expand Up @@ -6627,7 +6622,6 @@ export const data = [
event_id: '1616318632825_357',
event_time: 1600372167,
properties: {
content_type: 'product',
contents: [
{
price: 8,
Expand Down Expand Up @@ -7048,7 +7042,6 @@ export const data = [
event: 'Search',
event_id: '84e26acc-56a5-4835-8233-591137fca468',
event_time: 1600372167,
properties: { content_type: 'product' },
user: {
locale: 'en-US',
email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f',
Expand Down
2 changes: 0 additions & 2 deletions test/integrations/destinations/tiktok_ads/router/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,6 @@ export const data = [
content_id: '1197218',
},
],
content_type: 'product',
currency: 'USD',
value: 46,
},
Expand Down Expand Up @@ -2294,7 +2293,6 @@ export const data = [
content_id: '1197218',
},
],
content_type: 'product',
currency: 'USD',
value: 46,
},
Expand Down

0 comments on commit 4235a7b

Please sign in to comment.