Merge pull request #3623 from betagouv/fix-3622-sendinblue-js-again-and-again-and-again
Fix 3622 sendinblue js again and again and again
This commit is contained in:
commit
4dc9f5e9d1
3 changed files with 18 additions and 0 deletions
14
app/views/layouts/_sendinblue.html.haml
Normal file
14
app/views/layouts/_sendinblue.html.haml
Normal file
|
@ -0,0 +1,14 @@
|
|||
:javascript
|
||||
(function() {
|
||||
window.sib = { equeue: [], client_key: "#{Rails.application.secrets.sendinblue[:client_key]}" };
|
||||
/* OPTIONAL: email for identify request*/
|
||||
window.sib.email_id = '#{current_administrateur.email}';
|
||||
window.sendinblue = {}; for (var j = ['track', 'identify', 'trackLink', 'page'], i = 0; i < j.length; i++) { (function(k) { window.sendinblue[k] = function() { var arg = Array.prototype.slice.call(arguments); (window.sib[k] || function() { var t = {}; t[k] = arg; window.sib.equeue.push(t);})(arg[0], arg[1], arg[2]);};})(j[i]);}var n = document.createElement("script"),i = document.getElementsByTagName("script")[0]; n.type = "text/javascript", n.id = "sendinblue-js", n.async = !0, n.src = "https://sibautomation.com/sa.js?key=" + window.sib.client_key, i.parentNode.insertBefore(n, i), window.sendinblue.page();
|
||||
})();
|
||||
|
||||
sendinblue.identify('#{current_administrateur.email}', {
|
||||
'DS_SIGN_IN_COUNT' : '#{current_administrateur.sign_in_count}',
|
||||
'DS_CREATED_AT' : '#{current_administrateur.created_at}',
|
||||
'DS_ACTIVE' : '#{current_administrateur.active}',
|
||||
'DS_ID' : '#{current_administrateur.id}'
|
||||
});
|
|
@ -22,6 +22,9 @@
|
|||
= stylesheet_link_tag :xray
|
||||
|
||||
= render partial: "layouts/matomo"
|
||||
- if administrateur_signed_in?
|
||||
= render partial: "layouts/sendinblue"
|
||||
|
||||
|
||||
:javascript
|
||||
DATA = [{
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
= csrf_meta_tags
|
||||
|
||||
= render partial: "layouts/matomo"
|
||||
= render partial: "layouts/sendinblue"
|
||||
|
||||
:javascript
|
||||
DATA = [{
|
||||
|
|
Loading…
Reference in a new issue