Installation guides
Ghost
Add ProductLense to a Ghost publication through Code injection in the site header, with no theme edits.
Ghost has a site-wide code injection box that prints into the <head> of every page, including posts, tags and member pages. Paste the ProductLense script there and you do not need to touch the theme.
Add the script
- In Ghost Admin, open Settings → Code injection.
- Paste the two tags into Site header. Replace
SITE_IDwith the id from Settings → Sites in the ProductLense dashboard. - Save.
<script>window.productlense=window.productlense||function(){(window.productlense.q=window.productlense.q||[]).push(arguments)}</script>
<script defer data-site="SITE_ID" src="https://api.productlense.app/a.js"></script>Identify members
Ghost themes can read the signed-in member with the @member helper. To link paying members to their first visit, add this to your theme's default.hbs, after {{ghost_head}}:
{{#if @member}}
<script>
window.productlense('identify', '{{@member.uuid}}', { email: '{{@member.email}}' });
</script>
{{/if}}Sending the email trait lets ProductLense match Stripe payments for Ghost memberships by email. See how payments are attributed and Stripe.
Verify your installation
- Open your publication in a normal browser window, signed out of Ghost Admin.
- Open the Live page in the ProductLense dashboard. Your visit appears within a few seconds.
- In the browser's developer tools, the Network tab shows a
POSTtohttps://api.productlense.app/api/ewith status204.
A local Ghost install runs on localhost, where nothing is sent unless you add data-dev="true" to the tag. Ad blockers in your own browser may block the request. If the visit does not appear, follow Verify your installation.