-
Notifications
You must be signed in to change notification settings - Fork 2
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
Implement option to switch between conversion_async and gtag #20
Merged
alexs-mparticle
merged 7 commits into
master
from
feat/71444-implement-enhanced-conversion
Oct 25, 2021
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
3e96281
Add built forwarder js to html test runner
alexs-mparticle 30c7fe2
Implement gtag as an alternative to conversion async
alexs-mparticle 9fb5751
Refactor and address code review comments
alexs-mparticle dc068f0
Fix broken tests
alexs-mparticle 98e2899
Address Code Review Comments
alexs-mparticle 22e6155
Fix bug where null value is placed in DataLayer
alexs-mparticle 0deb460
Address Code Review Comments and remove unused code
alexs-mparticle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -185,20 +185,26 @@ | |
} | ||
|
||
// gtag Events | ||
function getBaseGtagEvent(conversionLabel) { | ||
return { | ||
'send-to': gtagSiteId + '/' + conversionLabel, | ||
'value': 0, | ||
'language': 'en', | ||
'remarketing_only': forwarderSettings.remarketingOnly == 'True' | ||
} | ||
} | ||
|
||
function generateGtagEvent(mPEvent, conversionLabel, customProps) { | ||
var conversionPayload = { | ||
'send-to': gtagSiteId + '/' + conversionLabel | ||
}; | ||
if (!conversionLabel) { return }; | ||
|
||
var conversionPayload = getBaseGtagEvent(conversionLabel); | ||
return mergeObjects(conversionPayload, customProps); | ||
} | ||
|
||
function generateGtagCommerceEvent(mPEvent, conversionLabel, customProps) { | ||
var conversionPayload = { | ||
'send-to': gtagSiteId + '/' + conversionLabel | ||
}; | ||
if (!conversionLabel) { return }; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto to returning |
||
|
||
var customProps = getCustomProps(mPEvent, isPageEvent); | ||
var conversionPayload = getBaseGtagEvent(conversionLabel); | ||
|
||
if (mPEvent.ProductAction.ProductActionType === mParticle.ProductActionType.Purchase | ||
&& mPEvent.ProductAction.TransactionId) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -705,7 +705,11 @@ describe('Adwords forwarder', function () { | |
'conversion', | ||
{ | ||
'send-to': 'AW-123123123/commerceLabel123', | ||
sale: 'seasonal sale' | ||
currency: 'USD', | ||
language: 'en', | ||
remarketing_only: false, | ||
sale: 'seasonal sale', | ||
value: 450 | ||
} | ||
]; | ||
|
||
|
@@ -739,8 +743,11 @@ describe('Adwords forwarder', function () { | |
} | ||
}); | ||
|
||
// debugger; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove |
||
|
||
failMessage.should.not.be.null(); | ||
failMessage.should.be.containEql("Can't send to forwarder") | ||
window.dataLayer.length.should.eql(0) | ||
done(); | ||
}); | ||
}); | ||
|
@@ -771,6 +778,7 @@ describe('Adwords forwarder', function () { | |
|
||
failMessage.should.not.be.null(); | ||
failMessage.should.be.containEql("Can't send to forwarder") | ||
window.dataLayer.length.should.eql(0) | ||
done(); | ||
}); | ||
}); | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think we should return an explicit
null
, so that it's not just returning a payload ofundefined
which looks like it could be a bug.