I used the Browser State/ajaxify gist (https://github.com/browserstate) on a Wordpress-based website to dynamically load content. The problem I'm running into is that now my Google DFP ads aren't loading when the content is dynamically loaded.
The ads worked normally before, so I'm not sure exactly what the issue is. Am I overlooking something simple, or are there extra steps that need to be taken?
The problem is the javascript that load ads from dfp read your page when it's ready. But with your ajax loading mechanism, you never inform this javascript that it need to re-read the page and load newly inserted tags.
So you have to catch the new content insertion event and fire the loading method that the dfp javascript provide.
Related
We recently switched to Sitecore CMS, and I seem to be having a problem with Event tracking as a result.
Any file extension is being tracked successfully using GTM and Event tracking as long as the link is pure - ie fetched automatically using Sitecore assets.
However, if I link to a document in the media library using the text editor, it automatically adds ?la=en to the end of the URL. (It used to have loads more code added, but our developer removed this.) I haven never been able to see these links as Events in GA, and I think it is because of this variable that gets added.
Has anyone come across this issue, and have any suggestions?
Thanks,
Ben
I have a section of my website that has a map inside a div that has an id with "display:none;" for mobile users. I would like to use Google Tag Manager and display that div with the map but I noticed that using a trigger by pageview is kinda slow when loading. The page loads and the div eventually displays the map but it shows broken since the js already loaded.
Is there a faster way to trigger a custom html tag with GTM other than pageview? Thank you
You cannot do anything in GTM before page load, since GTM itself needs to be downloaded and executed first (and due to async loading you cannot exactly tell when a tag is being executed). So no, there is now way.
When a user lands on a page, I want to show a custom HTML popup. I have Google Tag Manager integrated with the website.
Can this HTML Popup be shown using Google Tag Manager? (script and code to be inserted using Google Tag Manager)
Is it frowned upon / not advised to use google tag manager for
anything apart from tracking?
1.) Yes - GTM is pure Javascript, and inserts Javascript into the page code, so anything you can do you can do via GTM. There are some minor caveats (e.g. a size restriction on custom HTML tags), but doing a popup should work just fine.
2.) There are certain use cases that are discouraged - Google recommends against (or at least used to) making visible changes to the page markup via GTM. The problems with that are that GTM is loaded asynchronously, so you would not know at which point the changes show up and you might get "flickering" pages, and a possible performance impact when you force the page to re-render.
Nothing of this applies to popups, so you should be fine (although using popups these days might have its own problems, but these are not related to GTM).
Personally I would recommend against implementing popups via GTM if the popup is an integral part of your page; splitting up an application between page code and GTM code will sooner or later confuse a developer. But if this is just advertising or a call to action or something similar then (IMO) using GTM is not a problem at all.
I am having some troubles with malicious ads that show interstitials with no close button.
Inspecting the code, I found that DFP uses <iframe> tags to load the ads, but as the content of those iframes are loaded using Javascript (using iframe's document.write(), without src attribute), they get full access to parent window through window.top and window.top.document, allowing advertisers to inject code, show malicious ads and even stole data such as user emails and passwords.
In order to prevent this, I'm looking for a way to block DFP ads to access the main window. Is it possible?
Consider using SafeFrames rather than Friendly Iframes you appear to be using. Quoting from DFP's help page on the subject:
We recommend using SafeFrames and creatives compatible with SafeFrame for expansion instead of friendly iframes. SafeFrame is supported in DFP and enabled by default when using GPT tags. It enables transparent and rich interactions between page content and ads, while preventing external access to sensitive data and providing more granular control over which creatives are rendered
I think you use synchronous rendering, try to change it to asynchronous
https://support.google.com/dfp_premium/answer/183282?hl=en
I know the page reload concept via ajax without page refresh.
But facebook pages reload through normal page load. but sidebar's not loading just reload content area.
How is it possible?
Advance Thanks friends
Facebook uses bigpipe
The general idea is to decompose web pages into small chunks called pagelets, and pipeline them through several execution stages inside web servers and browsers. It is implemented entirely in PHP and JavaScript.
Clicking and taking some action on a webpage initialize/executes a pagelet, response generates from iframe or from ajax as well. Read the response and show it to a small chunk, this will not refresh the page.
I believe they are using the new history.pushState functionality in HTML5.