Where are website script sources coming from? - javascript

I have an unwanted Google Tag Manager popping up on my company's website. We have lost access to the old tag manager (hence the new one).
Using Chrome Dev tools I am able to see the unwanted tag id as a source (http://www.googletagmanager.com/gtm.js?id=GTM-XXXXXX) along with the new correct tag. However, I am not able to work out where that script is coming from!
Is there anyway to work out what is injecting that script into our site?

Directly you won't be able to see which tag have been implement from old GTM. But on the basis of your analysis you might be able to figure out.
just take a look in your new GTM account and compare those tags whatever is there on your website by using TAG ASSISTENT (By GOOGLE). and also check goals, ecommerce and other configuration google analytics account , conversion tracking and remarketing in your adwords account.
if you haven't implement some of these tracking code using new GTM, there is chances that you had implemented through old GTM. In this case try to re-implement those tag using new GTM and then remove old GTM from backend.
NOTE: remove OLD GTM in case of suspicious activity otherwise not required just to avoid data lose

Related

Dynamically Firing A gTag Event with Google Tag Manager

I have a script that fires a dynamic gTag.js adwords conversion based on various user interactions taken on that page. This worked fine when I had gTag.js installed. However I recently upgraded to Google Tag Manager and now my code:
gtag('event', 'conversion', {'send_to':'Dynamic Bits Here'});
Is throwing an error. How can I convert this to be picked up by Google Tag Manager? I've tried pushing to the dataLayer directly with:
window.dataLayer.push('event','conversion', {'send_to':'Dynamic Bits Here'});
However Adwords does not pick that up as a conversion. What I don't want to do is have to install a adwords conversion tracker in tag manager for every conversion as there are a ton of them.
Should I just keep gTag.js installed alongside tag manager???
If gtag is already installed and works fine for you, then you can just leave it, especially if you use only Google tags - gtag is build to deploy all kinds of Google tracking, and running both gtag and GTM is a lot of Javascript for essentially the same purpose.
GTM does not by itself send data to Google Ads without a respective tag.
However there is usually no need to install multiple Google Ads tags in GTM. What you usually would do is to create variables in GTM that pick up the dynamic bits, and then plop the variables into the Google Ads tag. So instead of having one tag for every conversion, you have a single tag that is dynamically configured depending on the values pushed to the datalayer.

Event Tracking with Google Analytics in a Standalone HTML App

I work with internet connected touchscreens that can run HTML projects. The HTML projects must be self contained in that all assets like scripts, css, images, videos, etc... must be in the local file structure on the hardware in case the unit loses internet connectivity. The units have a built-in web server for this basic use with a chromium browser.
I'm wanting to track events on specified DOM elements using Google Analytics so those events can be recorded when the unit has an active internet connection.
For example... If a button is clicked to perform some sort of action on the page and in that action I want to include an audit call to send that event to my GA account. Pretty standard use of this: https://developers.google.com/analytics/devguides/collection/analyticsjs/events
However, I can't seem to figure out how to make this work on a page that isn't hosted on a typical website. Everything I'm finding doesn't deal with this specific scenario and always relies on a page hosted on a typical site.
How can I track events using Google Analytics on a standalone HTML page?
Thanks,
~Mike
Can you try with sending your events by using Google Tag Manager to Google Analytics.It is quite easy to implement.
Try with adding the Google Tag Manager code, you get once you create the account in tag manager.And add your analytics property id to a custom variable in tag manager.Then create a page view type tag with analytics property id.
sample link for your reference https://support.google.com/tagmanager/answer/6102821?hl=en
Once you are able to link tag manager to your HTML page you can start tracking the page view event.Similarly, you can track other types of events.

GA Basics – Best practices for page view tracking in dynamic PHP based sites

Sorry for the basic question, but I've been reading lots on this and haven't been able to piece together a solution (as a rookie developer) so thought maybe asking would be helpful to me and others in the same boat.
I'm attempting to install GA (gtag) on a PHP site. The initialisation code works fine, Google Tag Assistant is happy, but the site functions similar to a single page application whereby the content is all loaded in dynamically via js into a DIV (little floating overlays).
I've read that creating a separate analyticstracking.php file is a best practice for the inclusion of your tracking code on pages (using include_once), but doing this on the dynamically loaded php files seems to throw up an error within tag manager – "Same web property ID is tracked twice."
My assumption was that this was happening because the page name didn't change, which would be logical, but if true, how and where does one change the page name?
Is it best to do this as an event when the nav item loading content is clicked, or is it best to somehow include tracking data in the PHP files for loaded content (and how)? If the latter, is is possible to pass the page name to the included analyticstracking.php call on load?
Or perhaps I doing this all wrong and should I be using Google Tag Manager?
Thanks in advance,
Joel
Best solution for your situation i guess will be something called "virtual pageview". Google Analytics documentation describes it here: https://developers.google.com/analytics/devguides/collection/gtagjs/single-page-applications
In shortcut:
Include Google Analytics (or GTag) code only once, for example in head.
Every additional content loading (which is key for you and want to treat as a new pageview) should send JS code with new "virtual" pageview to GA with datas seted by you (like new pageview title, new pageview url etc.).
Forget about sending events in this case as a "core". Of course you can also track events with nav clicks but first implement virtual pageviews.

Facebook conversion pixel and google tag manager

I am not an engineer but im asking question beyond my understanding. The company i work for recently reported that the Google Analytics often gave us wrong statistics. When i tried to scrawl the website's HTML code , I found that the facebook conversion pixel code was put ahead of the google tag manager code on our website. Does that affect how google analytics work ? In my mind, google analytics suggests us not to put other tracking code to interfere GA.
While it defeats the purpose of tag management systems to have tags outside the tag management container Google Analytics will work just fine with other tracking pixels, and Google certainly does not say anywhere that you should not use other tracking software. Nobody would use GA if it interfered with the normal operations of a website.
So no, the Facebook Pixel will not interfere with GA. You can easily check if the data is transmitted correctly if you use the Chrome extensions that Google provides - look for "Google Tag Assistant", that's the most userfriendly option. Install it via the Google Play Store, it will add a small icon to the right of your adress bar, and if you click the icon you can enable it for any given domain. It will display an error via a red icon if something is wrong, and will give some detailled information about what is being sent to the Google Analytics tracking server. That might help you to find the actual error if there is a problem with data collection (it will not help you to find configuration problems).

Prevent Google Tag Manager from reading input-elements

I'm implementing Google Tag Manager (GTM) on multiple web applications. One of these applications asks the user for personal information. There are good processes for auditing the application code, to make sure that the personal information is stored safely and does not leak.
However, implementing GTM will inevitably mean that the web analysts can write and deploy JavaScript code that reads these input-fields and sends the information to third-parties (such as Google Analytics).
Is there a way of preventing Google Tag Manager from being able to access the input fields where the user enters this information?
I haven't used this with GTM v2, but in v1 you can blacklist types of tags via the code in your page (this cannot be overriden by configuration in the GTM interface) - so you can prevent users from implementing custom HTML/JavaScript Tags that may include code to extract information from the page. Remember to also blacklist custom JavaScript macros as they could do the same.
If your pages writes any information to global javascript variables you also have to disable the JavaScript variable macro (which would allow a user to write an extraction function in a macro), and possibly the DOM element macro
Better still, don't do blacklist, create a whitelist.
In addition while many people may have permissions to add tags there should be only one person with the right to publish changes who signs off every new Tag. That way there is at least somebody responsible if things go awry.

Categories

Resources