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

Added support for external attribution data #13

Merged
merged 2 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
homepage: "https://stape.io/"
versions:
- sha: 6955b64a199a667d6af5112fd2d4f1e6b4d15b90
changeNotes: Added support for external_attribution_data.
- sha: 896519ddfb566753a546dcc7fe4d105155b4ee21
changeNotes: Added array type support for hashData.
- sha: 0f9e4c832e0fdac18455a648c51adc1b6d75bb53
Expand All @@ -18,5 +20,3 @@ versions:
changeNotes: Add Operating Customer.
- sha: 7644a65be1d6fe8a6c4a5fe843d1d7784cb01991
changeNotes: Initial release.
- sha: 7e2db0139861393ca76913f12c665a8cca5f7321
changeNotes: Update API version, add consent fields.
8 changes: 8 additions & 0 deletions template.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,14 @@ function addConversionAttribution(eventData, mappedData) {
mappedData.conversionDateTime = eventData.conversionDateTime;
else mappedData.conversionDateTime = getConversionDateTime();

if(data.externalAttributionModel || data.externalAttributionCredit) {
mappedData.external_attribution_data = {};
if(data.externalAttributionCredit)
mappedData.external_attribution_data.external_attribution_credit = makeNumber(data.externalAttributionCredit);
if(data.externalAttributionModel)
mappedData.external_attribution_data.external_attribution_model = data.externalAttributionModel;
}

return mappedData;
}

Expand Down
30 changes: 30 additions & 0 deletions template.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,28 @@ ___TEMPLATE_PARAMETERS___
"displayName": "gclid",
"simpleValueType": true,
"help": "The Google click ID (gclid) associated with this conversion."
},
{
"type": "TEXT",
"name": "externalAttributionCredit",
"displayName": "External Attribution Credit",
"simpleValueType": true,
"valueValidators": [
{
"type": "REGEX",
"args": [
"-?\\d+(\\.\\d+)?"
],
"errorMessage": "The value must be double"
}
]
},
{
"type": "TEXT",
"name": "externalAttributionModel",
"displayName": "External Attribution Model",
"simpleValueType": true,
"valueValidators": []
}
]
},
Expand Down Expand Up @@ -799,6 +821,14 @@ function addConversionAttribution(eventData, mappedData) {
mappedData.conversionDateTime = eventData.conversionDateTime;
else mappedData.conversionDateTime = getConversionDateTime();

if(data.externalAttributionModel || data.externalAttributionCredit) {
mappedData.external_attribution_data = {};
if(data.externalAttributionCredit)
mappedData.external_attribution_data.external_attribution_credit = makeNumber(data.externalAttributionCredit);
if(data.externalAttributionModel)
mappedData.external_attribution_data.external_attribution_model = data.externalAttributionModel;
}

return mappedData;
}

Expand Down
Loading