• Welcome to the Chevereto User Community!

    Here, users from all over the world come together to learn, share, and collaborate on everything related to Chevereto. It's a place to exchange ideas, ask questions, and help improve the software.

    Please keep in mind:

    • This community is user-driven. Always be polite and respectful to others.
    • Support development by purchasing a Chevereto license, which also gives you priority support.
    • Go further by joining the Community Subscription for even faster response times and to help sustain this space
  • Chevereto Support CLST

    Support response

    Support checklist

    • Got a Something went wrong message? Read this guide and provide the actual error. Do not skip this.
    • Confirm that the server meets the System Requirements
    • Check for any available Hotfix - your issue could be already reported/fixed
    • Read documentation - It will be required to Debug and understand Errors for a faster support response

Google Analytics

DJohnson

Chevereto Member
I must use code in the head of the Document

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="URL_HERE"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'ANALYTICS_ACCOUNT');
</script>

However on the Theme Setting it says:
https://gyazo.com/75be0d8d7642d5dd9bc445a90b4597a8

so i cannot use Google Analytics with Chevereto?

There are two Script tags that need to be used and the first is not a simple <script> but one with an inline URL

While i could omit the first and just use:

window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'ANALYTICS_ACCOUNT');

The Async URL will not be used and i feel this will break the tracking.

I saw in the "external services section" that you can place some Analytics code, but it says this will go in the footer:

b9f1949b7b569baedc1396c2dc4369db.png

https://gyazo.com/b9f1949b7b569baedc1396c2dc4369db

But i am instructed to use the Header for this. What can you advise on getting the Tracking working?
 
Google changes that stuff from time to time, by when this was implemented they asked to implemented it somewhere else. In any case, is safer if you directly inject these using theme custom hooks.

https://chevereto.com/docs/theme#custom-hooks

[CODE lang="php" title="/app/themes/Peafowl/custom_hooks/head_open.php" highlight="7-15"]<?php

if (!defined('access') or !access) {
die('This file cannot be directly accessed.');
}
?>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="URL_HERE"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'ANALYTICS_ACCOUNT');
</script>
[/CODE]
 
Back
Top