How do I add Google Analytics Tracking code to all pages


#1

Matrix Version:

Squiz Matrix v5.5.5.1

How do I add Google Analytics Tracking Code in the footer to all pages? I can’t find the documentation for it.

Thanks!


(Tim Trodd) #2

There are different ways to implement this but I would recommend using a nested content design area in the design file e.g.

<MySource_AREA id_name="google_analytics" design_area="nest_content" cache="1" cache="1" />

Put the code in a standard page using a RAW html container. (put the page somewhere that people wont navigate to e.g. inside a resources/global nested content folder or something)

Then in the design customisation choose that page to nest in.

It will then print out on all the pages that use that design customisation.It also gives you the option to change it easily if you need a certain section/site to have a different analytics account/code using a new customisation.

Cheers,

Tim


#3

Thanks Tim. I can’t work that out. Are you able to point me to some documentation on how to do this?
For now I have added the tracking codes to after %paint_layout% and it seem to be working.


(Jsisk) #4

You need to add the above line that ttrodd has provided into the Design Parse File.
In order to find out which design is applied to the site/asset, you can find out from the settings screen of an asset from the admin interface of Matrix. This is sometime a Design customisation and not the actual Parse File asset, which is normally the top level parent.

Please be aware, Design assets are not Safe Editable and any update is usually a global change, so please make sure to test fully in isolation before making a global change that could potentially take down all the pages on you site!! Make sure to close them tags!

Once the “nest_content” area has been created, you can then customise it and select the asset that you want to appear on the front end of the site, e.g. the Standard page asset containing you GA Tracking Code.

For more information on ‘Design Asset’, please check out the following manual page, https://matrix.squiz.net/manuals/designs/chapters/design-asset