Count sales on your thank-you page
This article shows you how to add one line to your thank-you page, so funnel statistics show which path, answer and A/B version sells.
Available on: every plan. Starter can have up to 10 live funnels; Pro, Business and Agency have no limit.
How it works
- A viewer watches your funnel and clicks an offer button.
- PlayerMagick adds a short code to your checkout link,
pm=…. It is issued by PlayerMagick for that click, after a real play of the funnel, and says nothing about the viewer. - The viewer pays on your checkout page, which sends them to your thank-you page.
- The line on your thank-you page reads the
pmcode and reports the sale. PlayerMagick credits it to the path, the answers and the A/B version of that click.
Statistics show these sales as "reported by your thank-you page". PlayerMagick does not see your payments: it counts visits to your thank-you page that carry a valid code.
Step 1: Copy the line
- Open your funnel and click Get embed code (or click an offer step).
- Under Count sales for each path, click Copy.
The line looks like this (with your funnel's ID):
<script async src="https://cdn.playermagick.com/v1/thanks.js" data-pm-sale="f_8kq2Tz4WmA1b"></script>
Step 2: Add it to your thank-you page
Paste the line into a custom HTML element of the page buyers see after paying, and only there. Anyone who opens that page with a valid code counts as a sale, so don't put it on a page people can reach without buying.
To count revenue too, turn on Add sale value under the line, then enter the Amount (the price of what this page sells, for example 69) and the Currency (a three-letter code such as USD or EUR). The line updates by itself; copy it again. It then looks like this:
<script async src="https://cdn.playermagick.com/v1/thanks.js" data-pm-sale="f_8kq2Tz4WmA1b" data-pm-amount="69" data-pm-currency="USD"></script>
When the price is not always the same
Add sale value writes one fixed amount into the line. That is right when the thank-you page belongs to one product at one price. It is wrong when the same thank-you page follows several products, prices, coupons or order bumps: every sale would be counted at the amount you typed.
In that case, let your checkout fill in the real amount of each order. Many checkouts let you add your own tracking code to their thank-you page and put order details into it with placeholders. Paste the line there and replace the amount and currency with your checkout's placeholders. Placeholders look different in each checkout, for example:
<script async src="https://cdn.playermagick.com/v1/thanks.js" data-pm-sale="a_Zx81Qp0LmN2c" data-pm-amount="{{order_total}}" data-pm-currency="{{currency}}" data-pm-order="{{order_id}}"></script>
<script async src="https://cdn.playermagick.com/v1/thanks.js" data-pm-sale="a_Zx81Qp0LmN2c" data-pm-amount="[order_amount]" data-pm-currency="[order_currency]" data-pm-order="[order_number]"></script>
<script async src="https://cdn.playermagick.com/v1/thanks.js" data-pm-sale="a_Zx81Qp0LmN2c" data-pm-amount="%TOTAL%" data-pm-currency="%CURRENCY%" data-pm-order="%ORDER_ID%"></script>
These are only examples of the format: your checkout's help lists its own names (look for "custom tracking code", "thank-you page scripts", "merge fields" or "placeholders"). Check that:
- the amount comes out as a plain number with a dot for decimals, such as
1249.50: not$1,249.50and not1.249,50; - the currency comes out as a three-letter code, such as
USDorEUR; - the code runs only on the page buyers see after paying.
If your checkout can't fill in the amount, leave Add sale value off: sales are still counted, without revenue.
If your checkout can put its order number on the thank-you page, add data-pm-order="A-1001" too (up to 64 letters, digits, dots, colons, dashes or underscores). PlayerMagick then never counts the same order twice.
The line shows nothing on your page and never slows it down.
Step 3: Keep the pm code on the way to your thank-you page
The thank-you page must receive the pm code. How depends on where it is:
- On the same website as your sales page (for example
yoursite.com/offerandyoursite.com/thanks): nothing to do. If the code is missing from the address, the viewer's browser remembers the code of their last offer click on that site for a day and uses it. - On another website (for example your checkout platform's own thank-you page, or another domain): the address of the thank-you page must keep
pmfrom the checkout link, for examplehttps://thanks.example.com/done?pm=…. In your checkout platform, look for a setting that passes the checkout link's parameters on to the thank-you page (often called "pass URL parameters" or "forward query string").
After reading the code, the line removes pm from the address bar, so it is not copied or shared.
What counts and what doesn't
| What happens | Counted as |
|---|---|
| A buyer arrives with a valid code from an offer click | One sale, credited to its path |
| They reload the page, open it in a second tab, or come back later | Nothing more: one code is one sale |
| The same buyer clicks two offers and pays twice | Two sales |
| A visit with no code, an unknown code, or a code older than 90 days | Not a sale. Statistics show it as "thank-you page visits without a link to a path" |
| A code from a checkout link that was not opened after a real play of the funnel | Not a sale |
A sale also marks the viewer's browser as a buyer on that website, for the Already bought condition. See Choose each viewer's path with conditions.
Sales of normal videos
The thank-you line can also name your whole account instead of one funnel, so automations' Bought trigger and They haven’t bought condition work for sales after a normal video.
To copy it, open any funnel, click an offer step and find Count sales of your whole account. The line is the same in every funnel of your account and names it with data-pm-sale="a_…":
<script async src="https://cdn.playermagick.com/v1/thanks.js" data-pm-sale="a_Zx81Qp0LmN2c"></script>
On Pro, Business and Agency, a sale after a click on a normal video's button is also linked to that video, its A/B version and how far the buyer watched (see Show a call-to-action button during the video).
It also counts the sales of all your funnels, each for its path. Use it instead of a funnel's line on a thank-you page that several funnels or videos share. The amount, currency and order attributes work the same way, and Add sale value is under this line too. A shared thank-you page usually follows products at different prices: use a fixed amount only if they all cost the same, otherwise let your checkout fill in each order's amount (see When the price is not always the same).
Strict security settings
If your thank-you page sends a Content Security Policy, it needs https://cdn.playermagick.com in script-src and in connect-src. See Fix a video on a site with strict security settings.
Troubleshooting
- The statistics say "Sales aren’t counted yet. Add the line to your thank-you page." No sale was seen in 30 days. Check that the line is on the page buyers see after paying.
- The statistics show "thank-you page visits without a link to a path". Buyers reach your thank-you page without the
pmcode. If the page is on another website, make your checkout passpmon (Step 3). Also check that buyers clicked the player's offer button, not a buy button of your own page. - "Already bought" doesn't match on my sales page. It works only when the thank-you page is on the same website as the sales page.
- Revenue shows nothing. Turn on Add sale value, enter the amount and currency, and paste the updated line on your thank-you page.
- Statistics stopped but sales still count. That is expected when you reach your monthly stats limit: sales are still counted.