XF 1.3 Update Analytics Tracking Code to Support Display Advertising

asusforo

Member
I received an message from Google with the request to update my Analytics tracking code, so i can receive
Demographics and Interest Reports and support display advertising.

see more information on: https://support.google.com/analytics/answer/2444872?hl=en&utm_id=ad

At this moment i use the general google_analytics template and i added my tracking ID in admin stats options.

But how can i implement the new tracking code? And i dont know if Xenforo is using the classic or the universal code?

Google says:

To implement Display Advertising features for Classic Google Analytics, replace the bold text in this example:

<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxxx-y']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;

ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';

var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
with the bold text in the example below:

<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxxx-y']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;

ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';

var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>

Im new in this world, so please support me.
 
can i just put the new analytics universal code into google_analytics template and thats all?
You mean like this?

Code:
<xen:if is="{$xenOptions.googleAnalyticsWebPropertyId}">
<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', '{$xenOptions.googleAnalyticsWebPropertyId}', 'auto');
ga('send', 'pageview');

</script>
<!-- End Google Analytics -->
</xen:if>
:D
 
@Tracy Perry the OP needs to have the specific "display advertising" part included I think.

Was just reading about this topic myself and not sure what it even does when you implement the doubleclick cookie.
 
@Tracy Perry the OP needs to have the specific "display advertising" part included I think.

Was just reading about this topic myself and not sure what it even does when you implement the doubleclick cookie.
Yep, but the point I was attempting to get across is that you can place the new code base in there (with any additional parameters that GA reflects you can use) and replace the default one. ;)
 
Top Bottom