Skip to content

Commit

Permalink
Merge pull request #13 from stape-io/external-attribution-data
Browse files Browse the repository at this point in the history
Added support for external attribution data
  • Loading branch information
Bukashk0zzz authored Jan 29, 2024
2 parents 82440fe + 9480038 commit 058d011
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
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

0 comments on commit 058d011

Please sign in to comment.