GTM - Track all downloads except certain classes - triggers

I currently have a trigger in GTM that tracks when certain documents are downloaded, such as pdfs, xlsx, png, docx, jpg... etc..
This is setup to track on the entire site, however I have a specific section that I don't want tracked by this catch all.
I've been trying to add an exception that says if a download link contains the class "Library_Download" then don't track it under the catch all trigger.
I'm trying to bring more clarity to what types of files are being downloaded.
I have tried adding exceptions to the tag, or adding validation to the trigger that and I seem to be missing something.
Catch All Trigger
Trigger Type: Click - Just Links
Trigger Fires On: Element URL Path - matches RegEx
\.(pdf|xlsx|png|docx|jpg|jpeg|zip|pat|dwg)$
How do I not count any link that contains the class "Library_Download" Or is there another way I should have them omitted?
I've created the following trigger and added it as an exception to the tag but it didn't work.
Trigger Type: Custom Event
Event name: \* (Enabled regex matching)
Trigger Fires on: Click Class - contains - "Library_booking"
Nov 21 Edit
So to clarify a bit more with HTML. Below is what I'm currently using for my library_download link. I'm currently only concerned with the pdfdownload.pdf
<div class="resource_row">
<div class="resource_item large <?php echo $post->post_name; ?>" data-filter-item data-filter-name="<?php echo $post->post_name; ?>">
<a href="www.librarywebsite.com/librarypage/" ><?php the_post_thumbnail('medium'); ?></a>
<p><?php the_title(); ?></p>
<ul class="resource_icons">
<li><img src="<?php bloginfo('stylesheet_directory'); ?>/img/icon-download.png" alt="Download PDF" /></li>
<li><img src="<?php bloginfo('stylesheet_directory'); ?>/img/icon-library.png" alt="library" /></li>
</ul>
</div>
</div>
This is how a regular link would look like (the only thing that's changed is I have removed the class Library_Download
<div class="resource_row">
<div class="resource_item large <?php echo $post->post_name; ?>" data-filter-item data-filter-name="<?php echo $post->post_name; ?>">
<a href="www.librarywebsite.com/librarypage/" ><?php the_post_thumbnail('medium'); ?></a>
<p><?php the_title(); ?></p>
<ul class="resource_icons">
<li><img src="<?php bloginfo('stylesheet_directory'); ?>/img/icon-download.png" alt="Download PDF" /></li>
<li><img src="<?php bloginfo('stylesheet_directory'); ?>/img/icon-library.png" alt="library" /></li>
</ul>
</div>
</div>
Like I've mentioned my catch all trigger currently get's triggered on every single PDF download, I just want to omit the links that have class "Library_download".

In my opinion you made a mistake in your regex in "Custom Event" exclusion rule (that's why this rule doesn't work). You have "\*" (with regex matching checked). Try to change regex to:
.*
This will match every event (and then of course preserve this: Trigger Fires on: Click Class - contains - "Library_booking").
In your case regex like this: "\*" will match only to event strictly named as "*" (star)

Related

How to locate multiple text element within class in Protractor?

For on my test i need to verify highlighted text (Lexington, KY) using my protractor test.
<li id="address" class="list">
<div class="content">
<small class="mb-1">
<span>
Suite # 278
<br>
</span>
**Lexington, KY**
</small>
</li>
How to verify highlighted text using css OR cssContainingText locator?
Actually Protractor creators have put great documentation in place , and pls read it thoroughly to gain good knowledge on usage of css & cssContainingText. I will answer your question in short here - Use element(by.cssContainingText('.content','Lexington'))
UPDATE 1:
In case you want to add an assertion .. do this - expect(element(by.cssContainingText('.content','Lexington'))).toContain('Lexington, KY')
For one I am confused because it seems like you are never closing the content div...is it closed after the li is closed?
Anyway...I would simply change the HTML so that you don't need some crazy convoluted mess of a selector. I would do it like this:
<li id="address" class="list">
<div class="content">
<small class="mb-1">
<span>
Suite # 278
<br>
</span>
<cityState>Lexington, KY</cityState>
</small>
</li>
function checkCityState(){
return element(by.tagName('cityState')).getText();
}
expect(checkCityState()).toBe('Lexington, KY');

how to redirect pages in jsf 2?

i have a simple menu on jsf:
<h:panelGroup id="panelMenu">
<h:form id="menuForm">
<ul class="nav nav-tabs" id="myTab">
<li class="active"><h:outputLink value="contenido/Agrupaciones.xhtml"><h:outputText value="Agrupaciones" /></h:outputLink></li>
<li><h:outputLink value="contenido/Usuarios.xhtml" ><h:outputText value="Usuarios" /></h:outputLink></li>
<li><h:outputLink value="contenido/Modulos.xhtml" ><h:outputText value="Modulos" /></h:outputLink></li>
<li><h:outputLink value="contenido/Roles.xhtml" ><h:outputText value="Roles" /></h:outputLink></li>
</ul>
</h:form>
</h:panelGroup>
it works ok, but when im on one of my pages.. let say "users.xhtml" and from that page i go to another like "details" <h:outputLink value="../contenido/detalleUsuario.xhtml">, when i click again in my principal menu to go back to "users" the url looks like this:
contenido/contenido/Usuarios.xhtml when it should be contenido/Users.xhtml. so i get a "page not found error".
Use <h:link> instead of <h:outputLink>. The <h:link> treats the path as navigation case outcome and will always resolve it relative to the context path. So you can safely start the outcome with / without worrying about the context path.
<li class="active"><h:link value="Agrupaciones" outcome="/contenido/Agrupaciones.xhtml" /></li>
<li><h:link value="Usuarios" outcome="/contenido/Usuarios.xhtml" /></li>
<li><h:link value="Modulos" outcome="/contenido/Modulos.xhtml" /></li>
<li><h:link value="Roles" outcome="/contenido/Roles.xhtml" /></li>
Note that those links doesn't require a form at all. So the whole <h:form> as you've in your code is completely superfluous.

View Helper, Partial View or Something Else

I am new to Zend Framework and I have a question about something I am trying to do.
The main content of most pages of the application that I am working on will consist of 1 or more div elements that need to be styled the same.
Here is an example of the HTML that I want to generate:
<div id='admin-locations' class='panel'>
<header class="panel-header">
<h2>Locations</h2>
</header>
<div class='panel-content'>
<div id='locations-table' class='google-vis-table'></div>
<form id='locations'>
...
</form>
</div>
</div>
I know I can easily do this by pushing the form to my view script in my controller then adding this code to my controller.
<div id='admin-locations' class='panel'>
<header class="panel-header">
<h2>Locations</h2>
</header>
<div class='panel-content'>
<div id='locations-table' class="google_vis_table"></div>
<?php
echo $this->formLocations;
?>
</div>
</div>
But that is not DRY.
The example I used here has a Google Visualization Table and a Zend Form in it's content. Sometimes the panels will need to contain a form. Sometimes they won't, so I don't think form decorators are the way to go. So basically, the id of the panel, the panel header text and the content of div class='panel-content' need to be dynamic. Everything else will stay the same from panel to panel.
What is my best option here?
You might want to consider using partials:
http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.initial.partial
For example, you could have an admin-locations.phtml partial that contains:
<div id='admin-locations' class='panel'>
<header class="panel-header">
<h2>Locations</h2>
</header>
<div class='panel-content'>
<div id='locations-table' class="google_vis_table"></div>
<?php echo $this->form; ?>
</div>
</div>
Now you can simply repeatedly call the partial within a view, with or without supplying a form:
...
echo $this->partial('admin-locations.phtml');
echo $this->partial('admin-locations.phtml', array('form' => $this->yourForm);
echo $this->partial('admin-locations.phtml');
...
Hope this helps.

Need to Convert smarty file to zend? [duplicate]

This question already has an answer here:
Closed 12 years ago.
Possible Duplicate:
Need to change smarty file into zend file
Hi I have a one tpl file with the name of login.tpl in smarty..so now i need to create a form like login.php and ini file for this form in zend framework..
here is the example code..so need to convert to form and ini file for this in zend..
/* login.tpl file */
<div id="add-user-form" class="form">
<form action="/account/login" method="post">
{{input_text type="hidden" name="redirect_url" value=$smarty.server.REDIRECT_URL|default:"/"}}
<div class="contain">
<div class="fieldgrp">
<label> </label>
<div class="field"><p><h3>Enter User Credentials</h3></p></div>
</div>
<div class="fieldgrp">
<label for="login_name">Username </label>
<div class="field">{{input_text name="login" id="login_name" class="longfield" maxlength="100"}}</div>
</div>
<div class="fieldgrp">
<label for="login_password">Password </label>
<div class="field">{{input_text type="password" name="password" id="login_password" class="longfield" maxlength="100"}}</div>
</div>
<div class="fieldgrp">
<label> </label>
<div class="field"><input type="submit" value="Login" /></div>
</div>
</div>
</form>
</div>
You have a couple of options:
create a Zend_Form element and assign decorators to get the output you want
create a Zend_Form element and render it using the view script decorator to duplicate the layout of the form (easier then no. 1 but the level of reuse is low)
create the form using plain old html (you loose automatic rendering of errors, and need to output the value of each element manually)
use Smarty as your View in Zend Framework (it has the same cons as the option no.3)
Whichever path you choose you will have to get your hands dirty and learn something new. ZF documentation is a place to start. But be warned, Zend_Form is not for the faint of heart :)

Zend controller/view newbie puzzle: $_GET & $_POST empty - on receipt from HTML form within view

Zend newbie here ... And just to make it better, my mission is to build on top of someone else's pre-existing Zend site.
(BTW: zf show version --> Zend Framework Version: 1.11.1 -- I seem to have Zend_Form).
Here's the curious bit. All the forms are built in HTML within views. They seem to work, although I can't figure out how -- especially given what I am seeing.
I followed the convention and created a view for a test form and wrote the form:
<form action="<?php echo $this->url(array('controller'=>'ControllerName','action'=>'submit'));?>" method="post" style="margin-left:20px">
<p class="bold setmgr">Your email here:</p>
<div class="field">
<input class="text" type="text name="custEmail"/>
</div>
<div class="field">
<input class="button" value="Submit and be free!" type="submit"/>
</div>
</form>
The submitAction member in the controller is firing correctly. No problem.
But ALL the places I could look for the POST data appear to be empty!
echo "obj custEmail = [" . $this->_request->getPost('custEmail') . "]\n";
echo "GET custEmail = [" . $_GET['custEmail'] . "]\n";
echo "POST custEmail = [" . $_POST['custEmail'] . "]\n";
if ($this->_request->isPost()) {
$data = $this->_request->getPost();
Zend_Debug::dump($data);
}
They all produce nothing.
I'd be much obliged for a solution or even a clue about what is going wrong.
Thanks for reading.
Your form is not in the correct format.As it's PHP you can use form like this or you can even generate a ZEND_FORM(which is profound way to do it).It's always a good practise to work around with ZEND_FORM.If you still want to use this and the go by your way,here is th snippet I modified for you.
I am modifying the Code for you.Your View should have this form in it;
<form action="" method="post" style="margin-left:20px">
<p class="bold setmgr">Your email here:</p>
<div class="field">
<input class="text" type="text" name="custEmail"/>
</div>
<div class="field">
<input class="button" value="Submit and be free!" type="submit" name="submit"/>
</div>
</form>
<?php
echo $this->custEmail;
?>
Now write the following one on your ACTIOn,i.e. submitAction;
public function submitAction()
{
if ($this->getRequest()->isPost())
{
$custEmail = $this->getRequest()->getPost('custEmail');
echo $custEmail;
$this->view->custEmail = $custEmail;
}
}
Now check if it works for you or not.
Create a form using Zend_Form. When ZF already has a way to create forms, you should use that. Your method is like a hack and is not a recommended way to do things.
Check here on how to create a Zend_Form
http://framework.zend.com/manual/en/zend.form.html