Google Analytics tracking code for Deliver template

Hi Guys, I’ve installed the Google analytics code into the user/themes/deliver/templates/partials/base.html.twig file in between {{ assets.js() }} and {% endblock head%}

Looking at the page source the tracking code is sitting where it should (just before the ) but it seems that Google Analytics isn’t picking up the code…weird? Any ideas why this would be?

Do you have your website somewhere so we can check ? Sometimes it takes some time for google to pickup the code.

Hi Karol…mate thanks for looking at this. It has me puzzled!

The address is http://www.absolutemaintenanceandcleaning.com.au

Ok… everything appears to be fine. One thing you can try is replacing:

<script>

with

<script type="text/javascript">

in your analytics code.
But i don’t think it’s an issue. Also make sure that in your analytics date is set to Today. By default Google Analytics sets date for yesterday.
You can also check if Analytics collect data by going into Real-Time tab:
https://support.google.com/analytics/answer/1008083?hl=en

I don’t think it’s related to deliver anyways… Mostly it’s a configuration issue.

Ok cool…will test and let you know how it goes.

Ok…it seems like I just needed to be a little more patient with GA - seems to be all up and running now.

Glad you got it working :slight_smile:

Just to add onto this post I noticed that when I updated the template version it’s wiped out my analytics code.

So I’ve now added the code to the theme I’ve set up under user/themes/mytheme/templates/partials/base.html.twig using theme inheritance and that should solve the issue of future template updates.

Always helps to read the documentation!