added google analytics script

This commit is contained in:
2022-05-31 15:26:01 +02:00
parent a334bcfeed
commit 10957fcb41
5 changed files with 21 additions and 16 deletions

View File

@@ -225,3 +225,4 @@ blockquote {
display:block; display:block;
} }
.antispams { display:none;}

View File

@@ -149,7 +149,7 @@
<div class="row"> <div class="row">
<form action="{{ request.route_url('home') }}" method="POST" class="form"> <form action="{{ request.route_url('home') }}" method="POST" class="form">
<div class="col-sm-6 form-group"> <div class="col-sm-6 form-group">
<input class="form-control" id="name" name="name" placeholder="Nom et prénom" required <input class="form-control" id="name" name="name" placeholder="Nom et prénom - Tên họ" required
type="text" value="{{name}}"> type="text" value="{{name}}">
</div> </div>
<div class="col-sm-6 form-group"> <div class="col-sm-6 form-group">
@@ -157,8 +157,9 @@
type="email" value="{{email}} "> type="email" value="{{email}} ">
</div> </div>
</div> </div>
<textarea class="form-control" id="comments" name="comments" placeholder="Message" required rows="5"></textarea> <textarea class="form-control" id="comments" name="comments" placeholder="Message - Tin nhắn" required rows="5"></textarea>
<input class="form-control" id="ngot" name="ngot" placeholder="Mât Ngot" type="text">
<p class="antispams"><input class="form-control" id="antispams" name="antispams" type="text"></p>
<br> <br>
<button class="btn btn-primary" type="submit" name="form.submitted">Envoyer</button> <button class="btn btn-primary" type="submit" name="form.submitted">Envoyer</button>
</form> </form>
@@ -166,11 +167,4 @@
</div> </div>
</div> </div>
<script>
$(document).ready(
function(){
$('#ngot').hide()
}
)
</script>
{% endblock %} {% endblock %}

View File

@@ -118,5 +118,14 @@
</div> </div>
</footer> </footer>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-NBVRNJ9C0Y"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-NBVRNJ9C0Y');
</script>
</body> </body>
</html> </html>

View File

@@ -43,16 +43,16 @@ def home(request):
name = '' name = ''
email = '' email = ''
comments = '' comments = ''
ngot = '' antispams = ''
if 'form.submitted' in request.params : if 'form.submitted' in request.params :
name = request.params['name'] name = request.params['name']
email = request.params['email'] email = request.params['email']
comments = request.params['comments'] comments = request.params['comments']
ngot = request.params['ngot'] antispams = request.params['antispams']
# honeypot filled ? # antispams filled ?
if not ngot: if not antispams and comments != '':
# no, message is not spam, send it # no, message is not spam, send it
body = """ body = """
Bonjour, Bonjour,
@@ -64,7 +64,8 @@ a envoyé le message suivant via le formulaire de Contact du site :
{2} {2}
----- Fin du message ----- ----- Fin du message -----
Le site "meditation-sunyata.paris" Cordialement,
webmaster@meditation-sunyata.paris
""".format(name, email, comments) """.format(name, email, comments)

View File

@@ -16,7 +16,7 @@ sqlalchemy.url = sqlite:///%(here)s/cao_blogr.sqlite
# images location # images location
images_dir = /pyramid10/cao_sunyata/cao_blogr/static/img/ images_dir = /pyramid10/cao_sunyata/cao_blogr/static/img/
cao_blogr.admin_email = phuoc@caotek.fr cao_blogr.admin_email = webmaster@meditation-sunyata.paris
# Mailer configuration # Mailer configuration
mail.host = localhost mail.host = localhost
mail.port = 25 mail.port = 25