# Wyleex Script
# Configuracion
<script>
window.paywallConfig = {
paywallUrl: 'https://suscripcion.example.com',
type: 'metered', // premium, free_access
contentType: 'nota_periodistica',
cookieDomain: '.example.com', // con punto adelante para permitir sub-dominios
debug: true,
loginwallLimit: 20 // Cantidad de notas que dispara loginwall
allowedContentTypes: ["news", "nota"] // Tipos de notas con PW
};
</script>
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
# Escuchar eventos
<script>
// Debe ir antes de la llamada de "Paywall Script"
window.paywall = window.paywall || {};
paywall.queue = window.paywall.queue || [];
paywall.queue.push(['addEventListener', 'loginwall', function (event) {
// Aquí llaman a su implementación de Loginwall.
alert('Loginwall');
}]);
// Customwall recibe como parametro la cantidad de notas a la que se dispara
paywall.queue.push(['addEventListener', 'customwall:15', function (event) {
alert('Customwall');
}]);
paywall.queue.push(['addEventListener', 'checked', function (event) {
console.log("Wall fue mostrada:", paywall.paywall.showingWall);
console.log("Nombre de wall mostrada:", paywall.paywall.wall);
}]);
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Script
<script>
(function(d,s,e,t){e=d.createElement(s);e.type='text/java'+s;e.async='async';
e.src="https://libs.lavoz.com.ar/paywall/latest/pw.js";
t=d.getElementsByTagName(s)[0];t.parentNode.insertBefore(e,t);})(document,'script');
</script>
1
2
3
4
5
2
3
4
5
# Login user
<script>
paywall.signIn({
id: '1049875', // requerido
email: 'example@gmail.com', // requerido
first_name: 'Juan', // requerido
last_name: 'Salas', // requerido
avatar: 'https://example.com/path/to/avatar',
gender: 'male',
age: 45,
phone: '+54351556874',
roles: []
});
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
# Logout user
<script>
paywall.signOff();
</script>
1
2
3
2
3
# Comprobar usuario logueado
<script>
paywall.auth.isLogged(); // true or false
</script>
1
2
3
2
3
# Comprobar usuario suscrito
<script>
paywall.auth.isSubscribed(); // true or false
</script>
1
2
3
2
3
# Obtener datos de usuario
<script>
paywall.auth.user(); // Objeto de usuario or false
</script>
1
2
3
2
3
Ejemplo:
{id: "373053", email: "info@wyleex.com", first_name: "Nombre", last_name: "Apellido", avatar: "https://www.sitioweb.com.ar/fotos/avatar_lector/373053.jpg", …}
id: "373053"
email: "info@wyleex.com"
first_name: "Nombre"
last_name: "Apellido"
avatar: "https://www.sitioweb.com.ar/fotos/avatar_lector/373053.jpg"
identification_type: "DNI"
identification_number: "33437185"
phone: "3515931300"
checkSubscription: true
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
# Version asincronica
<script>
window.paywallConfig = {
paywallUrl: 'https://suscripcion.example.com',
async: true, // Necesario para que no chequee automaticamente
type: 'metered', // premium, free_access
contentType: 'nota',
cookieDomain: '.example.com', // con punto adelante para permitir sub-dominios
debug: true,
loginwallLimit: 20, // Cantidad de notas que dispara loginwall
allowedContentTypes: ["news", "nota"] // Tipos de notas con PW
};
// Debe ir antes de la llamada de "Paywall Script"
window.paywall = window.paywall || {};
paywall.queue = window.paywall.queue || [];
// With jQuery
$.ajax('/{AJAX_URL}').then(() => {
paywall.queue.push(['invoke', 'signIn', {
id: '1049875', // requerido
email: 'example@gmail.com', // requerido
first_name: 'Juan', // requerido
last_name: 'Salas', // requerido
avatar: 'https://example.com/path/to/avatar',
gender: 'male',
age: 45,
phone: '+54351556874',
roles: []
}]);
// Deben llamar al check
paywall.queue.push(['invoke', 'check']);
});
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Mostrar iframe de datos de suscripcion
<script>
// Si no existe aun la instancia
// window.paywall = window.paywall || {};
// paywall.queue = window.paywall.queue || [];
// {SELECTOR} es el query selector del elemento que se quiere seleccionar
// El innerHtml del elemento se va a reemplazar por los datos de la subscripcion.
// Ej.: #container
paywall.queue.push(['invoke', 'viewSubscription', '{SELECTOR}']);
</script>
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
# Mostrar JSON de datos de suscripcion
<script type="text/javascript">
// Si no existe aun la instancia
// window.paywall = window.paywall || {};
// paywall.queue = window.paywall.queue || [];
paywall.queue.push(['invoke', 'viewSubscriptionData', function(subscriptionData) {
console.log(subscriptionData);
}
]);
</script>
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
# GTM DataLayer
<script>
// Loginwall
dataLayer.push({
'event': 'gaEvent',
'eventCategory': 'subscriptions',
'eventAction': 'loginwall',
'eventLabel': 'soft' // hard
});
// Paywall
dataLayer.push({
'event': 'gaEvent',
'eventCategory': 'subscriptions',
'eventAction': 'paywall',
'eventLabel': 'metered' //direct, adblocker, incognito, exclusivo
});
// Selección pack digital
dataLayer.push({
'event': 'gaEvent',
'eventCategory': 'subscriptions',
'eventAction': 'subscriptionForm',
'eventLabel': 'Acceso Digital (Plan individual)'
});
// Checkout Pago
dataLayer.push({
'event': 'gaEvent',
'eventCategory': 'subscriptions',
'eventAction': 'subscriptionCheckout',
'eventLabel': 'Acceso Digital (Plan individual)'
});
// suscripcion Exitosa
dataLayer.push({
'event': 'gaEvent',
'eventCategory': 'subscriptions',
'eventAction': 'subscriptionSuccessful',
'eventLabel': 'Acceso Digital (Plan individual)'
});
// Evento última nota
dataLayer.push({
'event': 'gaEvent',
'eventCategory': 'subscriptions',
'eventAction': 'lastArticle',
'eventLabel': '/nota/810532/actualidad/emilio-luque-busca-recurso-legal-para-promover-suspensiones-despidos.html'
});
// Evento última nota premium
dataLayer.push({
'event': 'gaEvent',
'eventCategory': 'subscriptions',
'eventAction': 'lastArticlePremium',
'eventLabel': '/nota/810532/actualidad/emilio-luque-busca-recurso-legal-para-promover-suspensiones-despidos.html'
});
// Validación credencial club de beneficios
dataLayer.push({
'event': 'gaEvent',
'eventCategory': 'subscriptions',
'eventAction': 'validateClub'
});
// Validación codigo familiar
dataLayer.push({
'event': 'gaEvent',
'eventCategory': 'subscriptions',
'eventAction': 'validateFamilyCode',
'eventLabel': 'FAMILYCODE'
});
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# Tagging Cxense (opcional)
<meta name="cXenseParse:recs:publishtime" content="2018-12-03T14:42:08Z"/>
<meta name="cXenseParse:title" content="Título de nota"/>
<meta name="cXenseParse:description" content="Descripción de la página"/>
<meta name="cXenseParse:url" content="https://example.com/nota"/>
<meta name="cXenseParse:pageclass" content="article"/>
<meta name="cXenseParse:articleid" content="1000"/>
<meta name="cXenseParse:premium" content="false"/>
<meta name="cXenseParse:recs:premium" content="false"/>
<meta name="cXenseParse:tipoarticulo" content="nota"/>
<meta name="cXenseParse:recs:tipoarticulo" content="nota"/>
<meta name="cXenseParse:category" content="politica"/>
<meta name="cXenseParse:recs:category" content="politica"/>
<meta name="cXenseParse:tags" content="tag1"/>
<meta name="cXenseParse:recs:tags" content="tag1"/>
<meta name="cXenseParse:tags" content="tag2"/>
<meta name="cXenseParse:recs:tags" content="tag2"/>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16