I have a small blog on Symfony 4. I need to add views to the articles. Decided to use Google Analytics. But I did not find the normal documentation how to connect Google Analytics to the symfony 4.
In general, you simply have to append a script tag that is provided in Google Analytics' web interface. See either this or this answer on the help resource. Perhaps, that would be the best option for you, since you just have a simple blog. The script should probably be added in your base template, or the layout so that it renders just above the closing </body> tag.
Another option would be setting up a server-to-server interaction with GA. There are several bundles for that: one, two. But most probably you won't need that.
You can simply put the script in your default base layout like the conventional base.html.twig. If you want to minimize the interaction with the layout you can create a Twig function that returns the Tracking ID stored in parameters.yml, either use bundle that provides extra features for interaction with your server, have a look for GoogleAnalyticsBundle which is still maintained by a symfony core developer.
Related
I wish to use the results of the Google translation that results from right clicking on a web page in Chrome, as opposed to using the API. These results I will use as part of a web language learning tool. I have read this page: https://cloud.google.com/translate/attribution about adding a logo, and have also read the HTML markup requirements at https://cloud.google.com/translate/markup.
My question is as these terms and conditions pages are referring to the API, do they also apply to using the translation results of using the Chrome menu item? I could use the API but this is much simpler for my temporary need.
Yes, when you're using the Google Translate Tool in a page by using the right-click, you can see that it send a request to the Google Translate API.
In definition, you have to add Google Attribution.
I guess for a personal website or non-commercial use it might not be that big of an issue but still, it will avoid future ones.
I work in an industry where it's very common to have multiple GTM containers and multiple Google Analytics IDs installed on a single site. Each install supports a different 3rd party vendor, interested party, etc.
I'm trying to develop a solution where a "master" Google Tag Manager container can install "child" GTM containers, so that clients can use a single GTM container to manage all of these installs rather than maintaining them via source code. (Another artifact of the industry is that these vendors change a lot, so it's common to need to add and remove tracking code regularly.) .
I haven't been able to find any guidance on this...does anyone have any?
In the commercial version of GTM this is an actual feature called "zones" (where each linked container is a "zone"). This does basically want you want to do, since alternative zones can be loaded conditionally (i.e. based on hostname). Even apart from the price tag the feature is not perfect, though - for example each zone loads all of the GTM boilerplate code, so will load way more JS that you actually need.
For the free version you are basically out of luck. In theory you can implement an alternative GTM container via a custom HTML tag - that worked for me during some casual testing a while back, but is completely with any support and explicitly goes against Google's recommendations, so you probably do not want to use this in production.
A workaround might be the "environments" feature, if you load a different configuration in each environment, but while this might save your clients the trouble of changing a five or six digit id in their source code it would make maintaining the containers a nightmare.
I had a request to add Google tag manager to our website and i added it using Dynamic Tag Manage (DTM). I created a page load rule and added this script. But my client is saying it is not working as DTM adds the code to the page with an Iframe. Is there a way we can fix this issue?
Alternative is directly add in the page. I don't want to go in that route as we have to update our page templates for these tags.
Avoid adding Tag Manager code in any other tag containers. It is built to be a standalone tag management solution and Google won't provide support if it's embedded in a 3rd party solution.
Your best option is to just select one tag management solution and stick with that. Having multiple tag managers kind of defeats the purpose, no?
You should never use one TMS to deploy the code of another TMS. None of them were designed to be deployed in that manner and all sorts of bad / odd things could happen.
I have been searching around to find out anything that needs to be taken into consideration when upgrading to Universal Analytics.
I found this post:
Google Analytics - Upgrading to Async Code
He explains that if you are not doing anything advanced you should be ok. We have lots of event tracking in place that we would like to keep the same. We also have some Custom Variables I could do without and/or deal with in Custom Dimensions.
Other than that we have a fairly basic setup.
We do have a "keep alive" event in place also that helps determine an accurate time on site.
Another really important question has everything to do with being able to transistion from Classic analytics to Universal. Is this possible? I found an article that said it wasn't but that article was a couple months old and not sure if its still true.
Thoughts?
Universal Analytics is Google's newest tracking code. It is currently in beta phase, so you may want to hold off on it, depending on your resources... In principle it works more or less the same way as the async code. Here are the major points about it:
The syntax is different. All config/tracking is done by making a call to ga()
Some of the "config" arguments for things have been moved to the GA interface. For example, names and scope for custom variables are no longer passed as arguments on-page. They are now done within the GA interface. Actually to be more accurate, custom variables no longer exist. Google now has custom dimensions and metrics as a replacement. Custom dimensions are the closest translation to custom variables (they are pretty much the same in principle). Custom metrics are some kind of mix between dimensions and events.
Google currently does NOT offer a way to upgrade your profile(s)/account(s) to Universal Analytics style. In order to use Universal Analytics, you have to create a new account or profile. If you want to try Universal Analytics out, Google currently recommends implementing it along side the traditional or async version you already have implemented.
Google has not currently officially stated when or if they will provide a means to migrate existing profiles, though I personally think they eventually will, since preserving historical data and reducing time and costs associated with migrating is a huge concern to everybody.
In addition to #Crayon-Violent's answer, be aware that the current Core Reporting API (v3) doesn't support retrieving custom dimension/metric data.
This month Google anounced that classical analytics properties can be upgraded to Universal without any data loss.
Universal Analytics is a set of technological innovations that improve
the way data is collected and processed in Google Analytics. The
Universal Analytics Upgrade is a process you can use to upgrade all of
your classic Google Analytics properties into Universal Analytics
properties without losing any data or changing your account settings.
All Google Analytics properties will soon be required to use Universal
Analytics. Any properties that don’t follow the upgrade process will
be auto-transferred to Universal Analytics in the future.
You can upgrade your analytics property from analytics admin panel. https://developers.google.com/analytics/devguides/collection/upgrade/
In case of upgrade problems you can refer to Google group:
https://groups.google.com/forum/#!forum/ua-upgrade
I recently inherited a project loaded with Google Analytics and I had never worked with them before. The code migration to Universal Analytics was straightforward with the exception of moving from Custom Vars to Dimensions. Google's documentation does little to highlight this.
After some digging around I found a couple of things that I think may help others that are migrating:
1) Set up or edit custom dimensions & metrics
Note that when you set up the Dimensions you are provided with code snippets that you can copy & paste into your project.
2) How to use the code to send custom dimensions & metrics
This docmentation will help you understand the provided code snippets and learn how to better work with them.
I hope this info spares others some of the pain that I experienced going through this.
I've created a plugin like jQuery Migrate to backward compatibilty of eventTracking and other features.
Allow developers to migrate old methods _gaq.push() to ga() object.
https://github.com/empiricompany/universal-analytics-migrate
Every tutorial/example i can find for meteor shows a single view application. I would like to build something a little more complex. I'm unclear how to approach multiple views...preferably in a way that's somewhat scalable?
The iron-router package lets you access different views (layouts) by nice, REST-ful human-friendly clean URLs. It supports parameters in the URL, "loading" templates, waiting for subscriptions to finish loading, before and after hooks etc.
At this point you can only create Single Page applications with Meteor. Note that Single Page, doesn't mean you can't have several views - use iron-router for that.
But by design, Meteor serves a big fat unique JavaScript/HTML/CSS application down to the browser, though there's a feature request to allow incremental loading. It is then up to the application (or more precisely, the JavaScript framework), to dynamically render its views in order to display different "pages".
I was wondering the same thing and it took me way too much time getting something started. I finally got a paged app working solidly by using Backbone views and routes, so I created a simple boilerplate project to make setting up an app like this easier in the future.
Live demo here: backbone-boilerplate.meteor.com
Source code here: github.com/justinmc/meteor-backbone-boilerplate
Have you looked at madewith.meteor.com?
A bunch of apps there have multiple views using Backbone also Jonathan Kingston who created britto has started simple meteor framework called Stellar
At this stage of the game not sure if there really are best practices. But these two seem to be the current flow.
You can also make a tabbed interface for multiple views. There is a package project "Smart package for generating a tabbed interface with pushState" github project here: https://github.com/possibilities/meteor-tabs
The best solution right now is using a routing package (router is basic but works). The workflow is something like this:
declare routes; return a template name for each route
place the reactive helper provided by the package in your body tag
the reactive helper will return the template associated to that route
you create a template for each route and optionally set custom publish functions
Router will give you browser history (client side).
Note that at this time there are some limitation on the way Meteor handles html/js. They are load all at the same time. The bright side is that once the app is loaded, page transitions will be instant.