Google Analytics Plugin broken?

Hi

I have updated my Integrity theme a few weeks ago to Version 6.2.5.

Apparently my Google Analytics tracking code was deleted with that update.

Now, if I add it again, it sort of cuts the code, when clicking on “update”. So it is not part of the source code anymore.

Here’s the screenshot of how it cuts the code:

Any idea how to fix that?

Thanks,
Andrea

Hi @Anderheggen,

Thanks for reaching out.

The theme update can’t do that since it’s not related to that data especially the naming. I assume you updated the Google Analytics plugin.

You no longer needed that code, just adding the Google Analytics ID is enough, it will automatically generate the required code. And that meta tag is now optional field which you can leave it empty. Here is the code responsible for that

<?php

// =============================================================================
// VIEWS/SITE/GOOGLE-ANALYTICS.PHP
// -----------------------------------------------------------------------------
// Plugin site output.
// =============================================================================

// =============================================================================
// TABLE OF CONTENTS
// -----------------------------------------------------------------------------
//   01. Require Options
//   02. Output
// =============================================================================

// Require Options
// =============================================================================

require( TCO_GOOGLE_ANALYTICS_PATH . '/functions/options.php' );



// Output
// =============================================================================

// Check if has admin capabilities
if ( ! ( is_user_logged_in() && current_user_can( 'update_core' ) ) ) {
?>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=<?php echo $tco_google_analytics_id; ?>"></script>
<script>
	window.dataLayer = window.dataLayer || [];
	function gtag(){dataLayer.push(arguments);}
	gtag('js', new Date());

	gtag('config', '<?php echo $tco_google_analytics_id; ?>');
</script>
<?php
	echo $tco_meta_tag;
}

As you can see, the code is already there, just need a GA ID. Please remove the content of the Meta Tag option.

Thanks!

Thank you @Rad for the super-fast reply.

Did not read the instructions carefully enough.

Have great evening.

You’re most welcome! :wink: Have a great evening!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.