Pushing Typed text into data Layer GTM - No submit button - forms

I am trying to measure engagement (capture text input, send value into GTM data layer etc.) when a visitor clicks on dropdown and type into the text box (see screenshot).
The problem is, there is no submit button. Search and display is performed automatically. Wondering, is even possible to push entry text into GTM Data layer?
Form screenshot
Here is the part of the script
<div class="dropdown-menu open" style="max-height: 481.5px; overflow: hidden; min-height: 151px;">
<div class="bs-searchbox"><input type="text" class="form-control" autocomplete="off"></div>
<ul class="dropdown-menu inner" role="menu" style="max-height: 420.5px; overflow-y: auto; min-height: 90px;">
<li data-original-index="1" class="">
<a tabindex="0" class="indent-1 location-name" style="" data-tokens="null">
<span class="text">All Destinations</span><span class="fa fa-checkmark check-mark"></span>
</a>
</li>
<li data-original-index="2" class=""><a tabindex="0" class="indent-1 location-name js-state-AL" style="" data-tokens="null"><span class="text">Alabama</span><span class="fa fa-checkmark check-mark"></span></a></li>
.
.
.
.
.
</ul>
</div>

You can do this via custom HTML tag. In the tag you write a custom listener for the keydown browser event. It's slightly complicated but described very well in the link below by simo ahava.
https://www.simoahava.com/analytics/track-autocomplete-search-google-tag-manager/
Hope that helps.

Related

How to trigger a GTM Tag with a div class

I want to trigger a Google Tag Manager tag with the text within a div class. The text is "Accommodation offer successfully edited". I've tried element ids and classes to no success. Do you have any recommendation? Is this even possible?
There is nothing else on the page that makes it unique so I really have to go with what is inside this div
<div class="alert alert-success">
<button data-dismiss="alert" class="close close-sm" type="button">
<i class="fa fa-times"></i>
</button>
<i class="fa fa-check"></i>
Accommodation offer successfully edited
</div>

Unabe to Select MSCRM 2011 RiIbbon button from selenium Webdriver

I have written selenium code for smoke test on my MSCRM aplication. I am unable to click Ribbon Button . Action can be performed by simple click or double click.The Below two Code i have written for Button
WebElement Email = driver.findElement(By.xpath("//span[text()='Email Handling']"));
Actions action2 = new Actions(driver);
action2.moveToElement(Email).doubleClick().perform();
OR
// driver.findElement(By.xpath(".//*[#id='incident|NoRelationship|Form|fmc.incident.form.Button.EmailHandling-Medium']/span[2]")).click();
Below is HTML structure of page
<html webdriver="true">
<head>
<body scroll="no">
<noscript> <div style="padding:10px;background-color:#C9C7BA;"> <span class="warningHeader">Important:</span> <hr size="1" color="#000000"> <span class="warningDescription"> Microsoft Dynamics CRM makes <i>extensive</i> use of your Web browser's client-side abilities. You either have one of these features turned off or your security settings are set so high that they prevent these features from being used. To enable these features, change your browser settings to allow the Microsoft Dynamics CRM site to run JavaScript. Learn more. </span> </div> </noscript>
<!--[if MSCRMClient]> <script type="text/javascript"> var MS_CRM_CLIENT_OUTLOOK_INSTALLED=true; </script> <![endif]-->
<span id="crmEventManager"/>
<div id="crmHistoryManager" style="display:none;" count="1"/>
<div id="crmRecentlyViewed"/>
<div id="crmLookupMru"/>
<div id="crmTopBar" class="ms-crm-TopBarContainer ms-crm-TopBarContainerForm" style="visibility: visible; background-position: 719px 0px;">
<div id="crmRibbonManager" currentribbonelement="ribbonContainer0" style="">
<div id="ribbonContainer0" class="loaded" style="display: inline;">
<div id="Mscrm.Ribbon" class="ms-cui-ribbon" unselectable="on" aria-describedby="ribboninstructions" role="toolbar">
<span id="ribboninstruction" class="ms-cui-hidden" unselectable="on">undefined</span>
<div class="ms-cui-ribbonTopBars" unselectable="on">
<div class="ms-cui-tabContainer " unselectable="on">
<ul id="EntityTemplateTab.incident.NoRelationship.Form.Mscrm.Form.incident.MainTab" class="ms-cui-tabBody" unselectable="on" role="tabpanel" aria-labelledby="EntityTemplateTab.incident.NoRelationship.Form.Mscrm.Form.incident.MainTab-title">
<li id="incident|NoRelationship|Form|Mscrm.Form.incident.MainTab.Save" class="ms-cui-group" unselectable="on">
<li id="incident|NoRelationship|Form|Mscrm.Form.incident.MainTab.Actions" class="ms-cui-group" unselectable="on">
<span class="ms-cui-groupContainer" unselectable="on">
<span class="ms-cui-groupBody" unselectable="on">
<span id="incident|NoRelationship|Form|Mscrm.Form.incident.MainTab.Actions-LargeMediumLarge" class="ms-cui-layout" unselectable="on">
<span id="incident|NoRelationship|Form|Mscrm.Form.incident.MainTab.Actions-LargeMediumLarge-0" class="ms-cui-section" unselectable="on">
<span id="incident|NoRelationship|Form|Mscrm.Form.incident.MainTab.Actions-LargeMediumLarge-0-0" class="ms-cui-row" unselectable="on">
<a id="incident|NoRelationship|Form|fmc.incident.form.Button.EmailHandling-Medium" class="ms-cui-ctl-medium " unselectable="on" href="javascript:;" onclick="return false;" aria-describedby="incident|NoRelationship|Form|fmc.incident.form.Button.EmailHandling_ToolTip" mscui:controltype="Button" role="button">
<span class="ms-cui-ctl-iconContainer" unselectable="on">
<span class="ms-cui-ctl-mediumlabel" unselectable="on">Email Handling</span>
</a>
</span>
<span id="incident|NoRelationship|Form|Mscrm.Form.incident.MainTab.Actions-LargeMediumLarge-0-1" class="ms-cui-row" unselectable="on">
<span id="incident|NoRelationship|Form|Mscrm.Form.incident.MainTab.Actions-LargeMediumLarge-0-2" class="ms-cui-row" unselectable="on">
</span>
<span id="incident|NoRelationship|Form|Mscrm.Form.incident.MainTab.Actions-LargeMediumLarge-1" class="ms-cui-section" unselectable="on">
<span id="incident|NoRelationship|Form|Mscrm.Form.incident.MainTab.Actions-LargeMediumLarge-2" class="ms-cui-section" unselectable="on">
</span>
Can any one look into this Issue. I checked there is no frame on HTML page
I didn't got any exception but there is no action performing after click action on button
after wait of 1 min new window is opening in eclipse IDE and getting Class File Editor......Source not found Issue
I have just roughly looked at the html element via FireBug I found the top container
become like that
<div id="crmHistoryManager" style="display:none;" count="1"/> eventhough the div element ends on the same line but the fireFox has different interpretation
if we run your code, I get exception which state current element is not visible, hence you can't interact with so the FireFox has converted the given div into a top container for all other divs below.

A div containing images disappears on iphone

I have tried searching for a solution everywhere but could not find it. Hence posting a request here.
We have a website built on php code-ignition MVC framework, but the issue is with HTML rendering over various devices imo. a certain section on the bottom of the a rendered page disappears on iphone, it renders fine on ipad and normal browser. I have saved the page as HTML and am able to successfully reproduce it via chrome for devices (from developer tools), by switching over various devices.
The designer who helped create these templates are not accessible anymore, so I am not able to get any further help. I suspect it to be a CSS issue. The website uses twitter-bootstrap.
Screenshots:
Normal Browser & Iphone redering comparison:
(the div in question is marked by the arrow)
I have looked into the view source and the div in question appears on both versions in the HTML source:
<div class="button-holders button-overlay" id="button_holder">
<div class="col-sm-3 col-xs-3 noway" id="noway" style="display: block;">
<a id="noway1" style="cursor:pointer;text-decoration: none;"> <img src="./Coupon Crank_files/button.png" width="70" height="70"></a>
<a id="noway1" style="cursor:pointer;text-decoration: none;" onclick="rotate_crank_coupon_load('1', '0')"> NO WAY</a>
</div><!--noway-->
<div class="col-sm-3 col-xs-3 nah" id="nah" style="display: block;">
<a id="nah1" style="cursor:pointer;text-decoration: none;"> <img src="./Coupon Crank_files/nah.png" width="70" height="70"></a>
<a id="nah1" style="cursor:pointer;text-decoration: none;" onclick="rotate_crank_coupon_load('2', '0')"> NAH</a>
</div><!--noway-->
<div class="col-sm-3 col-xs-3 sure" id="sure" style="display: block;">
<a id="sure1" style="cursor:pointer;text-decoration: none;"> <img src="./Coupon Crank_files/sure.png" width="70" height="70"></a>
<a id="sure1" style="cursor:pointer;text-decoration: none;" onclick="rotate_crank_coupon_load('3', '0')"> SURE</a>
</div><!--noway-->
<div class="col-sm-3 col-xs-3 ohyeh" id="ohyeh" style="display: block;">
<a id="ohyeh1" style="cursor:pointer;text-decoration: none;"> <img src="./Coupon Crank_files/heart.png"></a>
<a id="ohyeh1" style="cursor:pointer;text-decoration: none;" onclick="rotate_crank_coupon_load('4', '0')"> OH YES</a>
</div><!--noway-->
<div class="report_abouse_style" id="report_abouse" style="display: block;">
<a class="badge badge_edit" id="report_abouse1" style="cursor:pointer;text-decoration: none;"> Report Abuse</a>
</div>
Could it be something that can be fixed via modifying the CSS?
I am attaching the html files to reproduce the issue locally: http://filenurse.com/download/c5d96491585893ee917842a6f11f8166.html
Any help in the right direction would be greatly appreciated.
Thanks in advance,
AD

Facebook like button not rendering in div with display:none

I am well aware that there are almost 10 duplicates of this question. But solutions of none of them work for me. So here are the details:
I am using carousel from bootstrap. I use carousel to display set of 3 divs on each cycle.
The structure is as follows:
<div id="myCarousel" class="carousel slide">
<div class="carousel-inner">
<div class="active item">
<div class="span4>content along with FB like button </div>
<div class="span4>content along with FB like button </div>
<div class="span4>content along with FB like button </div>
</div>
<div class="item"> <!-- this div has display:none -->
<div class="span4>content along with FB like button </div>
<div class="span4>content along with FB like button </div>
<div class="span4>content along with FB like button </div>
</div>
</div>
<a class="carousel-control left" href="#myCarousel" data-slide="prev">‹</a>
<a class="carousel-control right" href="#myCarousel" data-slide="next">›</a>
</div>
Above is the stripped down version, just to leave out the unnecessary stuff. The problem is, all the Facebook like buttons inside the div which has display:none set have width and height set to 0.
This problem occurs in Firefox(the latest version).
I am using the HTML5 version of like button generated using FB like button configurator.
Below is the resultant like button code in the hidden div:
<div data-show-faces="true" data-width="450" layout="box_count" data-send="false" class="fb-like fb_edge_widget_with_comment fb_iframe_widget" fb-xfbml-state="rendered">
<span style="height: 0px; width: 0px;">
<iframe scrolling="no" style=" height: 0px; width: 0px; class="fb_ltr fb_iframe_widget_lift" src="">
</iframe>
</span>
</div>
The like buttons in the active divs are the only ones visible. Even those in the modals (which are hidden initially) are not visible too.
How do I make it visible when div has display:none?
I had the exact same issue you are having and my code solution is below. The key thing to note is that anytime you see the facebook generated code having a height and width of 0 it means that the facebook button is loaded while the CSS on it is display:none. You can't just force it to be displayed because it is possible that the facebook button hasn't fully loaded by the time the bootstrap carousel has loaded. The trick is to display all your items in the carousel using active on the initial load then once your facebook buttons have loaded you can remove active from your non-starting slide.
<div id="myCarousel" class="carousel slide">
<div class="carousel-inner">
<div class="active item">
<div class="span4>content along with FB like button </div>
<div class="span4>content along with FB like button </div>
<div class="span4>content along with FB like button </div>
</div>
<div class="active item"> <!-- this div also is active for initial load -->
<div class="span4>content along with FB like button </div>
<div class="span4>content along with FB like button </div>
<div class="span4>content along with FB like button </div>
</div>
</div>
<a class="carousel-control left" href="#myCarousel" data-slide="prev">‹</a>
<a class="carousel-control right" href="#myCarousel" data-slide="next">›</a>
</div>
window.fbAsyncInit = function () {
FB.Event.subscribe('xfbml.render', function () {
$('.carousel-inner>.item:not(:first-child)').removeClass('active');
});}
If you set a div to display:none; by default all of the child objects will have display:none which means they wont show up. Same if you set the size to zero.
IMHO it's not the right way to do it, but try setting the child object to display: block; or display: inline; and giving it a defined size.
Put iframe version of Like button in any hidden content and it will work.
worked for me like a charm
I had similar issue but only in IE. I saw that iframe width and height stayed 0. This solved my problem:
.fb-like.fb_iframe_widget iframe{
width:60px !important;
height:60px !important;
}

Twitter Bootstrap subnav closes instead of activating link on iPhone

I've got the following nav on my site
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<button type="button" class="btn btn-navbar pull-right" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="brand" href="/"><span class="icon-chevron-up icon-medium"></span> Rocky Mountain Arts</a>
<div class="nav-collapse collapse">
<ul class="nav">
<li class="dropdown">
Gallery <b class="caret"></b>
<ul class="dropdown-menu">
<li>For Sale</li>
<li>Sold</li>
<li>Private Collection</li>
</ul>
</li>
<li>About The Artist</li>
<li>Contact</li>
</ul>
</div>
</div>
</div>
</div>
When I view the site on my desktop, I see everything as expected, and I can navigate all of the links.
HOWEVER: When I load the site up on my iPhone, press the toggle collapse button and then expand the dropdown, I cannot click any of the sub links within the dropdown menu, rather the menu closes and either the "about" or the "contact" link activate instead.
How can I fix this?
Thanks #MiikaL for the comment. Looks like it's a bug filed over at Github that no-one is really addressing in the official source code.
https://github.com/twitter/bootstrap/issues/4550
This can be reproduced on the github components demo page
http://twitter.github.com/bootstrap/components.html#buttonDropdowns
There are people with helpful info in the tread, and the 'hack' solution seems to be
// Fixes sub-nav not working as expected on IOS
$('body').on('touchstart.dropdown', '.dropdown-menu', function (e) { e.stopPropagation(); });
This issue is finally fixed in the latest Twitter Bootstrap as of version 2.2.2:
You can read a short summary about the changelog in 2.2.2 here:
http://forwebonly.com/things-you-should-know-about-twitter-bootstrap-2-2-2/