Skip to content
Open
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
28 changes: 28 additions & 0 deletions guides/addQueryParameterToExternalLink
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//As currently written, this adds ?visitor=visitorID to the end of an external link. The external link is added to the guide via a text block in the Designer.
//You can only reference metadata being currently sent via the Pendo agent. To see what values are available, use pendo.validateInstall() in the Developer Console.
//Use ${pendo.accountId} to provide the Account ID value
//Use ${pendo.getSerializedMetadata().visitor.metadataname} to get the value of a visitor level metadata field. Replace 'metadataname' with the name of the metadata field.
//Use ${pendo.getSerializedMetadata().account.metadataname} to get the value of an account level metadata field



(function (guide, step, dom) {
var textLinkElement = dom('._pendo-text-link');

if (!pendo._.isUndefined(textLinkElement) && !pendo._.isUndefined(pendo.visitorId)) {
var previousUrlLink = textLinkElement[0].href;
var newUrlLink = previousUrlLink + `?visitor=${pendo.visitorId}`;
//Replace ?visitor with whatever you want the query parameter to be named
//Replace ${pendo.visitorId} with the function that generates the query parameter value
textLinkElement[0].href = newUrlLink;
}

dom('._pendo-button-primaryButton').on('click', function() {
window.open(textLinkElement[0].href);
pendo.onGuideDismissed();
});

dom(textLinkElement).on('click', function() {
pendo.onGuideDismissed();
});
})(guide, step, pendo.dom);