GA: content>event>overview>event label.
I am using download tracker and I would like to make my reports "user friendlier",
the problem is, "this.href" function provide the "label" section in GA the name, which in that case takes the whole url (href="http://nameTheWebsite*/wp-content/uploads/2010/07/somethingToRead.pdf") and I would like to see only "somethingToRead.pdf" in my report.
the tracking code is:
_gaq.push(['_trackEvent','Download','PDF', this.href]);"
I am using WP.
now, I did some homework, and I believe that substr(this.href , -10) function could help but I don't know how to do it right.
Any help would be highly appreciatedׄ
Thanks in advance.
Gal
substr(this.href, -10) will only work correctly, whenever the filename is accidentially 10 characters long.
A more sophisticated solution would be something like this:
var page = this.href.splitOnLast('/'); // this should return an array with two elements: path and filename
page = (page.length > 1) ? page[1].substr(1) : page[0]; // just in case there is no / in the this.href
_gaq.push(['_trackEvent','Download','PDF', page]);
Now you should get "somethingToRead.pdf" in your Google Analytics tracking.
Related
Site URL: http://intulife.de/blog/
Hi,
I want to change the meta of a post in Wordpress from ("0 Kommentare") as it is right now (see website link) to this picture ("0 Kommentare . 10 Likes . Teilen").
"Kommentare" mean "Comments" in German
"Teilen" means "Share" in German
This should include a connection to facebook for every post.
I did a lot of research but couldn't find any plugin that seemed to include the desired functionality. I might need to hard code something but my php knowledge is very limited.
I hope you guys can give me some hints in which direction I should go to reach the desired goal.
You can use Facebook graph API SDK to find the no. of likes on each post and include that javascript on each post you write.
here is the sample code of how you can do it but before that, you have to register for Facebook API on facebook developer console.
FB.api(
"/{object-id}/likes",
function (response) {
if (response && !response.error) {
/* handle the result */
}
}
);
If you need more help comment below i will be more than happy to help
hi i create one custom page in WordPress like page-download.php
i access this page like
http://example.com/download
its word fine but i want access this page like
http://example.com/download?n=skype
http://example.com/download?n=firefox
etc every time n value change.
and also i want get n value in page-download.php
please tell me how to do it . i know how to work in php simple but in wordpress its not work
Why just not use, echo $_GET['n'] ?
When you hit this page directly from the URL like below, please change your parameter, because of that I have tried same method few days ago and I can't get the parameter value.
http://example.com/download?from_browser=skype
http://example.com/download?from_browser=firefox
You can get the value like below or as per the reference :
$blah = get_query_var( 'from_browser');
if(isset($blah)) // Your code will be here
Hope this help!!!
Here is the scenario that i am working with and currently stuck at a point.
Joomla article calls a HTML form using sourcerer plugin.
SO in the article i have something like
[source] << include form.html >> [/source]
On submit, Form.html send a AJAX POST call to a PHP file updates a Db table and then opens a new URL which is a payment gateway.
<-- This is where my problem lies -->
I need to give return URL to my payment gateway so that after successful payment it redirects to this page along with the transaction id as a parameter in URL.(For ex : www.mywebsite.com/thank-you/?trxid=131213&uniqueid=23424234 )
I need to capture this transaction id and print it in the article saying "Thank you for your payment. Your transaction id is xxxxxxxx ".
How should i proceed with the development ? How can i capture the POST / GET parameters in the Joomla article ?
Can anyone help me here?
Thanks in advance.
BR
Nilesh
If you are already using Sourcerer in your articles you should be able to embed your PHP code between your [sourcerer][/sourcerer] tags. The following PHP code will all you to query the post variables in your URL:
$JInput = JFactory::getApplication()->input;
$trxid = $JInput->get('trxid','','int');
$uniqueid = $JInput->get('uniqueid','','int');
That will set your values to the variables $trxid and $uniqueid. From there you can print them in your article using the sourcerer tags and an echo or print statement.
Change the 'int' to 'string' if those fields may be alphanumeric mixed strings.
Cheers and Good Luck
Here is the link for the Joomla documentation on using JInput as well for future use if you need it. Using JInput with Joomla
I am using Phaxio for send FAX and it's working fine till now.
Now i have to add some extra stuff to it. I want to generate some of the data in new pages into same PDF(generate PDF on success of send fax by phaxio).
Currently its being generate new pages only when while it's come up at bottom of the page.
i tried following code by paging paging parameters as given on Phaxio official site http://www.phaxio.com/docs/paging/ but it's not working at all or might be i don't know how to use it.
Please take a look at following code.
require ("Phaxio.php");
$apiKeys['test']='xxxxxxxxxxxxxxxxxxxxxxxxxxx';
$apiSecrets['test']='xxxxxxxxxxxxxxxxxxxxxxxxxxx';
$apiHost='https://api.phaxio.com/v1/';
$filename='html_data.html';
$toNumber="my-10-digit-phone-no";
$phaxio=new Phaxio($apiKeys['test'], $apiSecrets['test'], $apiHost);
$phresult=$phaxio->sendFax($toNumber, $filename,
array('maxperpage' => '400','page' => '1'));
echo "<pre>";
print_r($phresult);
if ( !$phresult->succeeded() ) {
echo ("<H4>Error sending fax to $toNumber with " . $phresult->getMessage()."</H4>");
return FALSE;
}
else {
echo ("<H4>Your fax has been sent.</<H4>");
return TRUE;
}
After spending couple of hours i finally got a very silly but useful solution.
Actually my requirement was that in my FAX PDF there was number of repeated HTML was there like generate invoice in same format(using loop), and i really need like every invoice HTML should be in separate PDF page.
So I've simply used CSS style="page-break-before:always;" and i was done with my issue.
1) via CSS - for the advanced HTML users:
<p style="page-break-after:always;"></p>
2) with a simple comment:
<p><!-- pagebreak --></p>
I am using the Google Analytics PHP class to get data from Google Analytics.
http://code.google.com/p/gapi-google-analytics-php-interface/wiki/GAPIDocumentation
I would like to get a report of "Bounce Rate" For "Top Contnet".
The thing is I am not familiar with the terminology.
When I am trying to get a "content" report or "topcontent" or "top_content" it says that there in no such metric. I simply don't know the right expressions.
Does anyone know where can I find a list of all expressions? metrics & dimensions?
Thanks.
Top content isn't a metric, it's just a list of the pages on your site with the highest number of page views.
The metric you're looking for is 'entranceBounceRate' and the dimension is 'pagePath'. You want to get the bounce rate for the top X most visited pages on your site, so you'll want to limit your results and sort the results by '-pageviews' (pageviews descending).
If you want to get the bounce rate for the top 10 most viewed pages on your site, your query should look like this:
$ga = new gapi('email#yourdomain.com','password');
$ga->requestReportData(145141242,array('pagePath'),array('entranceBounceRate','pageviews'),array('-visits'),null,null,null,10);
The Google Analytics Export API has a data feed query explorer that should help you out considerably when using GAPI:
http://code.google.com/apis/analytics/docs/gdata/gdataExplorer.html
Also, here's a list of all available dimensions and metrics you can pull from the API:
http://code.google.com/apis/analytics/docs/gdata/gdataReferenceDimensionsMetrics.html
Definitely read over the GAPI documentation:
http://code.google.com/p/gapi-google-analytics-php-interface/wiki/GAPIDocumentation
If you would like to get the global Bounce Rate for the last 30days (by default), here is how. Very simple once you know it.
//Check Bounce Rate for the last 30 days
$ga = new gapi(ga_email, ga_password);
$ga->requestReportData(145141242, NULL ,array('bounces', 'visits'));
$data = round(($ga->getBounces() / $ga->getVisits()) * 100) . "%";
Note that the GAPI has a bug, they mention the dimension parameter is optional (2nd parameter) but it's not. You have to open the gapi.class.php file and patch line 128 with this:
//Patch bug to make 2nd parameter optional
if( !empty($dimensions) ) {
$parameters['dimensions'] = 'ga:'.$dimensions;
} else {
$parameters['dimensions'] = '';
}