Skip to content

Conversation

@joe-ayoub-segment
Copy link
Contributor

@joe-ayoub-segment joe-ayoub-segment commented Oct 29, 2025

Enhancements to Google Enhanced Conversions.

  1. Add new field to collect IP address.
  2. Adds new session_attributes_encoded field
  3. Adds new session_attributes_key_value_pairs field

Testing

Unit tests updated.

Tested in staging - though without credentials

Confirmed payload is correct with team at Google.

@joe-ayoub-segment joe-ayoub-segment marked this pull request as ready for review October 30, 2025 12:34
@joe-ayoub-segment joe-ayoub-segment requested a review from a team as a code owner October 30, 2025 12:34
sayan-das-in
sayan-das-in previously approved these changes Oct 30, 2025
@joe-ayoub-segment joe-ayoub-segment changed the title STRATCONN-6214 - [Google Ads Conversions] - Enhancements STRATCONN-6214 - [Google Enhanced Conversions] - Enhancements Oct 31, 2025
@codecov
Copy link

codecov bot commented Oct 31, 2025

Codecov Report

❌ Patch coverage is 76.66667% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.95%. Comparing base (9ed58fa) to head (9c67b87).
⚠️ Report is 35 commits behind head on main.

Files with missing lines Patch % Lines
...tinations/google-enhanced-conversions/functions.ts 83.33% 3 Missing ⚠️
...nhanced-conversions/uploadClickConversion/index.ts 66.66% 0 Missing and 2 partials ⚠️
...hanced-conversions/uploadClickConversion2/index.ts 66.66% 0 Missing and 2 partials ⚠️

❌ Your patch check has failed because the patch coverage (76.66%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3376      +/-   ##
==========================================
- Coverage   80.00%   79.95%   -0.06%     
==========================================
  Files        1211     1223      +12     
  Lines       22353    22721     +368     
  Branches     4411     4518     +107     
==========================================
+ Hits        17884    18166     +282     
- Misses       3689     3720      +31     
- Partials      780      835      +55     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds enhancements to the Google Enhanced Conversions destination to improve conversion tracking capabilities. The changes add three new fields to capture additional session and user data.

Key changes:

  • Added user_ip_address field to capture the IP address of users who initiated conversions
  • Added session_attributes_encoded field with a default mapping
  • Added session_attributes_key_value_pairs field as an alternative to the encoded field for offline conversions

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
uploadClickConversion2/index.ts Added three new input fields and updated request object construction to conditionally include the new fields
uploadClickConversion/index.ts Applied the same field additions and logic as uploadClickConversion2 for consistency
uploadClickConversion2/generated-types.ts Updated TypeScript types to include the new fields in the Payload interface
uploadClickConversion/generated-types.ts Updated TypeScript types to match uploadClickConversion2
types.ts Added KeyValuePairList and KeyValueItem types and updated ClickConversionRequestObjectInterface
functions.ts Added timestampToEpochMicroseconds and getSessionAttributesKeyValuePairs helper functions
__tests__/uploadClickConversion2.test.ts Updated test snapshots and added new test for sessionAttributesKeyValuePairs
__tests__/uploadClickConversion.test.ts Updated test snapshots and added new test for sessionAttributesKeyValuePairs
__tests__/functions.test.ts Added tests for the new timestampToEpochMicroseconds function

}

export function timestampToEpochMicroseconds(timestamp: string): string | undefined {
if(!timestamp){
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space after 'if' keyword. According to JavaScript/TypeScript style conventions, there should be a space between 'if' and the opening parenthesis. Change if(!timestamp) to if (!timestamp).

Suggested change
if(!timestamp){
if (!timestamp){

Copilot uses AI. Check for mistakes.
Comment on lines +107 to +113
sessionAttributeKey:
'gad_source'
| 'gad_campaignid'
| 'landing_page_url'
| 'session_start_time_usec'
| 'landing_page_referrer'
| 'landing_page_user_agent'
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Inconsistent formatting of union type. The first line sessionAttributeKey: has trailing whitespace after the colon. For consistency and cleaner code, the union type definition should start on the same line as the property name or have consistent indentation. Consider reformatting to either sessionAttributeKey: 'gad_source' | 'gad_campaignid' | ... on one line or ensure consistent alignment.

Suggested change
sessionAttributeKey:
'gad_source'
| 'gad_campaignid'
| 'landing_page_url'
| 'session_start_time_usec'
| 'landing_page_referrer'
| 'landing_page_user_agent'
sessionAttributeKey: 'gad_source' | 'gad_campaignid' | 'landing_page_url' | 'session_start_time_usec' | 'landing_page_referrer' | 'landing_page_user_agent'

Copilot uses AI. Check for mistakes.
}

const { session_attributes_encoded, user_ip_address } = payload

Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Line 370 contains only trailing whitespace. Remove this empty line or ensure it doesn't contain any whitespace characters for cleaner code.

Suggested change

Copilot uses AI. Check for mistakes.
Comment on lines +361 to 363
const { session_attributes_encoded, user_ip_address } = payload

const request_object: ClickConversionRequestObjectInterface = {
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] For consistency with the codebase, consider whether the destructuring of session_attributes_encoded and user_ip_address should occur inline within the spread operators where they're used (lines 369-371), rather than as separate variable declarations. This would avoid creating intermediate variables that are only used once and make the intent clearer that these are conditional includes.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants