Combining Two OnClicks With One Link For Google Analytics?

Feb 5, 2009

This question pertains to Google Analytics (GA). GA provides a specific way you can assign a Goal to the event when a user clicks a link on your site that points to an external site.

Implementing this code isn't confusing, however, because it relies on the javascript onClick, I am worried it is conflicting with my links - as they, too, are configured using onClick. Here's an example of one of my links, with the GA onClick command added after it:

<a href="#" onclick="window.open('http://www.example.com', null, 'height=800, width=1000, toolbar=0, location=0, status=1, left=200, top=50, scrollbars=1'); return false" onClick="javascript: pageTracker._trackPageview("/G1/example");" title="Example">Click here to visit example</a>

As you can see, I am using onClick twice in the same code. I don't think that that's correct syntax. I tried putting them together like this, but it didn't work:

onclick="javascript: pageTracker._trackPageview("/G1/example"); window.open('http://www.example.com', null, 'height=800, width=1000, toolbar=0, location=0, status=1, left=200, top=50, scrollbars=1'); return false" title="Example"

how I can keep my onClick method of employing links with window.open, but also assign a trackPageview to the action for goal purposes.

View 4 Replies


ADVERTISEMENT

Google Analytics Behind A Paywall?

Feb 16, 2010

i'm currently pitching some website development. The majority of this site is behind a paywall (meaning users must pay subscription to view the content). There is much talk about google analytics being used. I can't help but wonder a few things about this:

1) does google analytics function correctly behind a paywall -- i.e., when a session is required for viewing?

2) Does this present any kind of security problems?

I'm imagining that the google analytics script will most definitely load if embedded in a paywalled page. I'm also imagining that such a script could easily parse the content of that page and deliver it to google. Any thoughts on this matter are welcome.

View 2 Replies View Related

Google Analytics Code In Safari?

Oct 6, 2009

code messing up their page view-ability in Safari on a Mac?

View 3 Replies View Related

Ajax :: How To Complete Script Like Google Analytics

Jun 3, 2010

I am trying to get my head around this AJAX/JS problem with IE where I am getting visitor info like cookie, ip, URL, referrer, user agent and sending it to an external domain where my database is storing all the stats for the client. In short something like Google Analytics does. My script is working fine in Firefox and chrome so far but getting "Access Denied" error on http.open() in IE. I did try derelict's method but I guess I am missing something and same thing happens in IE without error. It is not sending the data to external domain. I am sure many of you have tried and make it worked but I am not able to get it working. I have another option where I can add a php or asp file and use cURL to send the value but I want to make it simple like GA as there may be many clients with different servers and might not possible to add additional pages.

Code:
//This is processJS.shtml page to use PHP within JS
var guestID=getCookie('guestID');
if (guestID==null || guestID=="") {
setCookie('guestID',"-1",365);
} var guestID=getCookie('guestID');
var siteurl = '<!--#echo var="HTTP_HOST"-->';
var ip = '<!--#echo var="REMOTE_ADDR"-->';
var agent = '<!--#echo var="HTTP_USER_AGENT"-->';
var page = document.URL;
var ref = document.referrer;
var clientID = '123'; // clientID will be different for each client .....

View 3 Replies View Related

Google Analytics - Page Loading Slows Down

Jun 22, 2009

I've noticed that my site has been loading slower lately, especially in google images. I'm thinking that this could be due to the google analytics javascript. I was told that page load slows down if its placed on top (which I have). Is this true? I'm not really warming up to GA but I also don't want to nix it completely. Bottom placement doesn't work for me as GA does not record then.

View 3 Replies View Related

Make Google Analytics Valid Code?

Jun 13, 2011

I have the google analytics code but it is presenting itself as not valid.

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js'[code]....

ALso is this script suitable to link to externally?

View 6 Replies View Related

Setting Up ECommerce On My Google Analytics Account?

Nov 16, 2009

get some help setting up eCommerce on my Google Analytics account.How do I add a unique order ID to the javascript field? Do I just leave it blank? All of my customers are directed to the same thankyou page so I'm not sure how to track a bunch of unique order ID's on the one page.The code is on this site and the code I've altered below: I just need to alter the _addTrans and _addItem parts.http:[url]....This is my altered version:

HTML Code:
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");[code]....

View 1 Replies View Related

Google Analytics Won't Track If There Are Any JS Errors On Page?

Dec 1, 2009

I was reading the Google Analytics support docs and it says that webmasters must be careful not to have ANY javascript errors on their webpages, because if there is an error, GA will not log visits for that page.

Is this true? I often wrap add onclick functions to various links on my pages dynamically, eventhough I may not have declared the specific onclick function in the page (thus causing an error). Does this mean it won't track when I setup GA?

View 5 Replies View Related

Creating A Product Like Google Analytics With JavaScript

Aug 7, 2007

I've noticed that Google uses JavaScript to pass information to their servers for processing. I can only imagine they're passing back the HTTP request of the current request to pull the data from to track sessions, page views, time spent, etc. Does anyone have an idea of how they're actually doing this?

View 2 Replies View Related

Tracking Non-public Website Through Google Analytics?

Mar 26, 2010

so I figured I can track one page of the private website (intranet) through Google Analytics. The way I do this is by creating a page on a public website with just GA code, then putting a 1px x 1px iframe on the private website.

[Code]...

View 2 Replies View Related

Tracking Outbound Links Via Google Analytics?

Jul 26, 2010

how to track outbound links with Google Analytics. I had read a few posts online as to how it's done, and this is the coding I have set up for it:

<a href="http://www.mapsresearch.com" onClick="javascript: pageTracker._trackPageview('/outgoing/mapsresearch.com ');" target=�_blank�>

The "goal" setting in google analytics are:

Goal Name: mapsresearch.com
Active Goal: on
Goal Type: URL Destination

[code]....

View 1 Replies View Related

Jquery :: Google Analytics Track Form Submissions

Jun 9, 2009

I have a form that captures users email addresses when they sign up for a enewsletter. I want to add this form submission into my google analytics and from what I have read the best way to do this is by tracking an event? I have added some jquery that I mashed together and I just want to know will this work? I added it today and I can only find out if it has truely worked by waiting 24 hours. I downloaded a program called fiddler (recommended in dot net magazine) to see tracking requests in action instead of waiting 24 hours but I can't see any of the field names displaying like AMF signup?

<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-8736163-1");
pageTracker._trackPageview();
} catch(err) {}$(document).ready(function() {
$("#pre-book").attr("onSubmit", "pageTracker._trackEvent('Signup Forms','AMF Signup','Newsletter',2.0);");
});
</script>

View 8 Replies View Related

Stop Google Analytics Setting Cookies On Subdomain

Jul 7, 2009

I'm trying to serve static content from a cookieless subdomain s.mydomain.org.uk, so that image/css requests from pages at [URL] don't get sent with needless cookie data. The trouble is that Google Analytics insists on adding its cookies (_utma, _utmz) to those requests anyway!

My code is:
<script src="[URL]" type="text/javascript"></script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("xxxx");
pageTracker._setDomainName("www.mydomain.org.uk");
pageTracker._trackPageview();
} catch (err) { }
</script>

View 1 Replies View Related

Can't Make Same Ajax Call From Two Different Onclicks

Oct 9, 2011

I'm trying to call the same Ajax get PHP from two different elements Onclick. The second one isn't working.

Index.js
Code:
function getproduct(p){
if(p==' '){
document.getElementById('f1').innerHTML=' ';

[Code]....

View 1 Replies View Related

Multiple OnClicks Events Aren't Working Together?

Feb 14, 2009

I have a simple javascript overlay (like a lightbox) with a message that pops up. The user is meant to click a button, see the overlay thanking them for their vote, and then be redirected to the affiliate page (its a poll site) after about 3 seconds. I have everything down, except, it will either display the overlay as one of the onClick events, or it will do the timedRedirect but not both. I've tried putting the redirect before and after, and when its before it redirects, when its after, it shows the overlay. How can I do a timed redirect and show this message?

<script type="text/JavaScript">
<!--
redirectTime = "3500";
redirectURL = "http://x.azjmp.com/2KTCs";

[Code]....

View 2 Replies View Related

Stop Multiple Onclicks From Firing On Layered Divs?

Jun 6, 2010

I'm writing a GUI css/html editor in JavaScript which is a litte ambitious considering I just started with js like a month ago. Here's my first hurdle:

Users can add divs simply by clicking on the div or element in which they want the new div to reside. The creation of a new div is in the onclick event. However, when I click on a div, I'm getting an onclick events from it and all the divs positions below it, so it's creating multiple new divs and all I want is one!

Is there any way to make the onclick even fire for just the top layer div? Maybe using the z-index or something?

View 2 Replies View Related

Link To Google Doesn't Work In IE?

Jan 15, 2011

have this:

window.location='http://google.com#q=testquery'

works in opera / firefox / chrome / safari, but doesnt work in IE. does anyone have a fix or solution or hack around this problem? ps: the script is just to demonstrate my problem

View 9 Replies View Related

External Link Linked To Google Maps

Jul 19, 2011

I am trying to have a text link above Google Maps link to a marker on my map. When the link is clicked, the map will automatically center itself on the marker. I already have the custom markers and locations, I am just not that good with Javascript and jQuery to figure it out.

View 3 Replies View Related

Link Code To A Web Page Such As Mail.google.com?

Jul 15, 2010

i want to create an add on for mozilla browser which ll install in firefox n modify the web page on the fly,store the changes for next time visit

View 14 Replies View Related

HTML - Link To Scripts On Google - Local Copy As Fail-safe?

May 11, 2009

I want to save a bit of bandwidth and trouble by linking to scriptaculous and prototype on Google, a la:

CODE:

BUT, I would like to be able to specify a local copy of the scripts as a fail-safe alternative. Is there a simple HTML way to specify an alternate src property?

And I've tried searching, but "alternate script source" and various permutations just lead to useless HTML basics. ...and not the kind of basic HTML.

View 4 Replies View Related

Web Analytics For Intranet

Sep 7, 2010

My company is in the search process for using web analytics on our company intranet application. Anyone have any recommendations for some 3rd party software to accomplish this?

We use Google analytics for the public site, but according to the documentation, we have to use a fully qualified domain name for the intranet it order for it to work with google.

View 3 Replies View Related

Traffic Analytics Script Where Add The Same Code To All Domains?

Jan 29, 2010

With Google Analytics, you have to create a new profile for each domain, and post different code on each domain.

I'd like a traffic stats script (or website) where you can just add the same code for any domain, and that domain will be automatically tracked, even if it's a new domain. So if I have 100 domains and then add the same code to the 101st domain, it will track that domain fine.

Doesn't matter if the script needs to be hosted on your own server, or if it's 3rd party like Google Analytics. It can be commercial too if it's got an unlimited domain license. Anyone know of something like this?

View 3 Replies View Related

Combining 2 Functions Into One

Jan 30, 2010

I basically have 2 "if" statements. How would i go about combining them?

function validate_form(thisform)
{
with (thisform)

[code]....

View 6 Replies View Related

Combining Two Nodes In One?

Feb 17, 2011

I have two nodes with elements get by tag name.Now i want these two nodes merged in one node.ie:

list1 = document.getElementById("menu1").getElementsByTagName("a");
list2 = document.getElementById("menu2").getElementsByTagName("a");

View 14 Replies View Related

Google Maps Adding A Second Google Map To A Page

Apr 7, 2011

I'm not sure where I have translated this incorrectly. I have one google map embedded on my page which works fine. But I wanted to add a second one. I thought the easiest way to do this would be to have a second page which is called later on with all the details on it for the second map. However although I think (this I presume is where I went wrong) I have replicated the instructions correctly the place holder for the second map just remains blank.

This is the code for my called page with the instructions for the second map:

And this is the script of the main page, just in case I would be better off keeping them both in one place.

<head>

I've cut out the script that doesn't relate to this so I hope I haven't missed anything important.

View 1 Replies View Related

JQuery :: Combining Two Different Effects?

Apr 1, 2011

i'm completly new to this kind of stuff and now i have a (little) problem. First of all i had done a Accordion with Tabs like here:[URL]... Thats currently working. I split every head/title of the 3 panes in 2 parts (div), first the name of the head-pane, e.g. "First Pane" and a div-container for a navigation...

I want that the navigation part fade in of the current activating pane and the other navigations should be fade out.It's not easy to explain what i mean

[Code]...

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved