This code defines the tracking action and delays loading of the outbound link by 100 milliseconds so that Google Analytics can track the click: Insert this code in addition to the standard Google Analytics tracking code for the page. Complete control over which campaigns our clients can see in their accounts. And as with YouTube, if that limit was hit, they just have to add another number, which raises the limit to 1,152,921,504,606,846,976.
We want to tell Google Analytics that, instead of generating a new client ID when someone goes to Eventbrite's website, it can keep using the same one as before. Privacy and security[edit] A short URL obscures the target address and can be used to redirect to an unexpected site.
After that, it’s up to you to decide what you need. In order to form the key, a hash function can be made, or a random number generated so that key sequence is not predictable. Open the SiteCatalyst framework and expand the Link Tracking Configuration section.
We need to be careful and ensure tracking never stops user navigation even on failure. Twitter will use this to make your timeline better. Our link service measures information such as how many times a link has been clicked, which is an important quality signal in determining how relevant and interesting each Tweet is when compared to similar Tweets. Such URLs are difficult to memorize, type-out or distribute. You will need to make sure you have the standard google tracking script on your page too. You'll typically find the unsubscribe link in the footer.
A good structure accommodates future changes or alterations. Adding tracking directly to your site If you have added the Analytics tracking code directly to your site, you can copy and paste the script below into your own pages to set up Event tracking for outbound links. This can be added to existing JavaScript files or in a script block as long as it’s loaded somewhere within the HTML body (ideally, just before the closing tag). jQuery (or your alternative) must be loaded first although the Google Analytics tracking code can appear anywhere on the page. /* Track outbound links in Google Analytics */ (function($) { "use strict"; // current page host var baseURI = window.location.host; // click event on body $("body").on("click", function(e) { // abandon if link already aborted or analytics is not available if (e.isDefaultPrevented() || typeof ga !== "function") return; // abandon if no active link or link within domain var link = $(e.target).closest("a"); if (link.length != 1 || baseURI == link[0].host) return; // cancel event and record outbound link e.preventDefault(); var href = link[0].href; ga('send', { 'hitType': 'event', 'eventCategory': 'outbound', 'eventAction': 'link', 'eventLabel': href, 'hitCallback': loadPage }); // redirect after one second if recording takes too long setTimeout(loadPage, 1000); // redirect to outbound page function loadPage() { document.location = href; } }); })(jQuery); // pass another library here if required The event is recorded with the category name ‘outbound’, action name ‘link’ and the value set to the URL of the outbound page. Entering unique values into aff_sub or source parameters is a common cause of sluggish reporting. It's usually a good idea to announce, on any of your social media services you plan to use the shortener on, that you'll be shortening links through a custom domain form now on just so users feel comfortable clicking the links. For example, if your source is "newsletter", the medium should not be "email newsletter". When users recommend web pages to each other, email and bookmarking sites are second only to search engines. • URLs greater than 78 characters long will usually wrap across a line feed, increasing likelihood of breaking. If you click the shortened link on bit.ly, you get access to detailed traffic information related to number of clicks, referring Web sites, and geographic locations of the users who clicked. This can be done online, at the web pages of a URL shortening service; to do it in batch or on demand may require the use of an API. Twitter will use this to make your timeline better. For others, both of those options are necessary, structured and prioritized. Abbreviate or shorten: Use common abbreviations to make things shorter or just chop off some letters of your name. Get the details/analytics of Short URL //Request Format: var request = gapi.client.urlshortener.url.get({ 'shortUrl': "", 'projection':'FULL' }); //projection can be 'FULL',"ANALYTICS_CLICKS" or "ANALYTICS_TOP_STRINGS" //JSON Response { "kind": "urlshortener#url", "id": "", "longUrl": "", "status": "OK" } Google URL Shortener API PHP Example $longUrl, 'key' => $apiKey); $info = httpsPost($postData); if($info != null) { echo "Short URL is : ".$info->id."n"; } //Short URL Information $shortUrl=""; $params = array('shortUrl' => $shortUrl, 'key' => $apiKey,'projection' => "ANALYTICS_CLICKS"); $info = httpGet($params); if($info != null) { echo "Long URL is : ".$info->longUrl."n"; echo "All time clicks : ".$info->analytics->allTime->shortUrlClicks."n"; } //Get Full Details of the short URL $shortUrl=""; $params = array('shortUrl' => $shortUrl, 'key' => $apiKey,'projection' => "FULL"); $info = httpGet($params); var_dump($info); function httpsPost($postData) { $curlObj = curl_init(); $jsonData = json_encode($postData); curl_setopt($curlObj, CURLOPT_URL, ''); curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curlObj, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curlObj, CURLOPT_HEADER, 0); curl_setopt($curlObj, CURLOPT_HTTPHEADER, array('Content-type:application/json')); curl_setopt($curlObj, CURLOPT_POST, 1); curl_setopt($curlObj, CURLOPT_POSTFIELDS, $jsonData); $response = curl_exec($curlObj); //change the response json string to object $json = json_decode($response); curl_close($curlObj); return $json; } function httpGet($params) { $final_url = '?'.http_build_query($params); $curlObj = curl_init($final_url); curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curlObj, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curlObj, CURLOPT_HEADER, 0); curl_setopt($curlObj, CURLOPT_HTTPHEADER, array('Content-type:application/json')); $response = curl_exec($curlObj); //change the response json string to object $json = json_decode($response); curl_close($curlObj); return $json; } ?Overview The Google URL Shortener at goo.gl is a service that takes long URLs and squeezes them into fewer characters to make a link that is easier to share, tweet, or email to friends.