Expose transaction details (pageJson)
For developers and advanced users only
In page-builder, it is possible to add a JavaScript object to your page’s HTML that contains various properties of the page, such as donation amount. This can be used in Google Analytics or Tag Manager to create eCommerce transactions.
To enable this, go to where it says Hello YOURNAME in the top navigation, and then Account settings > Account Preferences and, near the bottom of the page, tick the box to “Expose transaction details”. Your page-builder pages will now contain a “pageJson” object that consists of various key value pairs:
amount | The amount of the donation (if made) |
appealCode | The Appeal Code (if applicable) |
campaignId | The master campaign ID |
campaignPageID | The page-builder’s campaign ID, as seen in the URL |
clientId | Your organisation’s (subaccount) unique ID |
country | The supporter’s tagged Country value |
currency | The currency of the donation (if made), e.g. USD |
donationLogID | The unique ID of the donation, if made |
giftProcess | Boolean (true or false) – whether a donation has been made or not |
locale | The locale code, e.g. en-US |
pageCount | The number of pages in the campaign |
pageName | The internal name of your page-builder campaign |
pageNumber | The page number of the campaign |
pageType | The page type, one of advocacypetition, click2call, datacapture, donation, e-card, e-commerce, event, emailsubscribeform, emailtotarget, membership, peer-to-peerevent, premiumgift, splitpage, staticpage, supporterhub, survey, tweetpage, unsubscribe |
paymentType | The payment type of a donation if applicable, e.g. VISA |
receiptNumber | The receipt number |
recurring | Boolean (true or false) – whether the donation was recurring or not, if applicable |
redirectPresent | Boolean (true or false) – whether a redirect is present in the page structure |
supporterID | The unique ID of the supporter, generated after submission |
trackingId | The tracking ID seen in the URL (if applicable) |
transactionType | The three-letter campaign type of the donation, if made, e.g. FCR |
upsell | Details on upsell lightbox include originalAmount (donation amount originally selected by supporter), name (lightbox name), and conversion (single to recurring or recurring upgrade) |
transactionId | The unique ID of the donation, generated after submission |
To access any of these variables, just format it like this: pageJson.amount
Example of what pageJson might look like on a petition page
Note that on Page 1 the system does not know who the supporter is, so there is no supporterID or country yet.
Page 1
var pageJson = {
"clientId":94,
"pageCount":2,
"pageName":"ENCC17 petition",
"giftProcess":false,
"campaignId":4757,
"campaignPageId":6565,
"pageNumber":1,
"locale":"en-GB"
};
Page 2 when petition submitted
var pageJson = {
"clientId":94,
"pageCount":2,
"pageName":"ENCC17 petition",
"giftProcess":false,
"campaignId":4757,
"campaignPageId":6565,
"supporterId":2259636,
"country":"GBR",
"pageNumber":2,
"locale":"en-GB"
};
Example of pageJson on a donation page
Note that giftProcess is true once the donation has been successfully completed and no donation information is available until the donation is submitted at Page 2.
Page 1
var pageJson = {
"pageName":"ENCC17 Donation page",
"clientId":94,
"giftProcess":false,
"pageCount":2,
"pageNumber":1,
"campaignId":4789,
"campaignPageId":6665,
"locale":"en-GB"
};
Page 2 when a donation has been made