We’ve migrated our documentation to a new site, which means some URLs have changed.
Subscriptions

How to add the _ptid parameter to any URL

In some cases, you will be using a separate page for checkout, instead of the user checking out directly on the page of the article they were viewing. This way, you won’t be able to see by default from which URL the user came from before they converted.

If any article has a button that redirects them to check out to the separate landing page, and this button isn't contained in a Piano Template, there will be no tracking (_ptid) parameter automatically appended to it.

With the following 3 steps, you're able to add this parameter programmatically:

  1. Create a Composer Experience, where you will target all pages and all users

  2. Add a RunJS Action card, that will find the Subscribe button which redirects the user to the separate landing page

  3. Inside this RunJS card add the parameter context.trackingId to the URL. This will append the _ptid parameter to the link

Sample code:

var subscribeButton = document.querySelector('.subscribe-button');
if (subscribeButton) {
  let newUrl = new URL(subscribeButton.href);
  newUrl.searchParams.set('_ptid', context.trackingId);
  subscribeButton.setAttribute("href", newUrl);
}

After this is implemented, the Composer Conversion report for your Pages will contain data about the article the user converted on, even if they've checked out using a separate landing/subscribe page.

Last updated: