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;
}
.antispams { display:none;}

View File

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

View File

@@ -118,5 +118,14 @@
</div>
</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>
</html>

View File

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

View File

@@ -16,7 +16,7 @@ sqlalchemy.url = sqlite:///%(here)s/cao_blogr.sqlite
# images location
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
mail.host = localhost
mail.port = 25