Skip to content

Availability

4.7.5

Paywall Javascript version 1.1

Target audience: Developers, Stakeholders

Including the javascript

For the Tulo Paywall to function as it should, you will need to include our JS on your site. Choose the correct file, depending on what environment you are working in.

Environment URL
Production https://payway-cdn.worldoftulo.com/js/1.1/paywall.js
Staging https://payway-cdn-stage.adeprimo.se/js/1.1/paywall.js

Attributes available on initialization

Below is a list of attributes available for use when initializing the Paywall Javascript v 1.1.

Attribute Type Description Required Available as resource in Paywall template
url string Tulo Paywall URL Yes No
jwtToken string Generated server side in Step 4 Yes No
debug boolean Set to true for additional information when troubleshooting No No
accountOrigin string Read more about Account origin No No
trafficSource string Read more about Traffic source No No
merchantReference string Read more about Merchant reference No No
returnUrl string Read more about Return url No Yes, [RETURN_URL]
backUrl string Can be used as an alternative link back to the website from Tulo Shop, not to be mistaken for the returnUrl. No No
loginUrl string Can be used to display a link for the customer to log in. No Yes, [LOGIN_URL]
shopUrl string Can be used for displaying a custom link to the Tulo Shop. For example to all available offers. No Yes, [SHOP_URL]
utmSource string GA support No No
utmMedium string GA support No No
utmCampaign string GA support No No
utmContent string GA support No No
resources object Overridable text resources. You'll find the available resources and default values here. No No
engageTracking object Engage BI tracking meta data No No
articleId
string If the Tulo Paywall is initiated from an article add the articleId to this parameter. No No
categories
array Categories e.g. ["cat 1", "cat 2"] No No
sections
array Sections e.g. ["sec 1", "sec 2"] No No
onError function Callback if a Tulo Paywall error occurs. Will override default onError behavior. Read more here. No No
customVariables object Custom variables to be used in the Paywall template upon rendering, a set of keys and values No Yes, each supplied key is available
key
string Value for the custom variable
Valid characters for key: [a-zA-Z-_]
Size range for key: ..100
Forbidden characters for value: <>{}\ &lt; &gt;
Size range for value: ..1024
No Yes, the key name is capitalized and referenced in the template by adding brackets around the name

Changes from version 1.0

Support for custom variables

When initializing the Paywall Javascript it is now possible to supply your variables in the attribute customVariables. Custom variables are supplied as keys and values. The key can be used in the Paywall template by adding brackets around and writing the key in upper case.

Example

Paywall Javascript initialization
<script type="text/javascript">
    new Paywall().Init({
        url: "https://payway-paywall-stage.adeprimo.se/api/paywall",
        jwtToken: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
        debug: false
        ....
        ....
        customVariables: {
            my_ipsum_statement: "Ipsum lorem..."
        }
    });
</script>
Paywall Template
<div> 
...
...
[MY_IPSUM_STATEMENT]
</div>
Rendered Paywall
<div> 
...
...
Ipsum lorem...
</div>