I would like to track the users on my Symfony 2.7 page using Piwik.
Piwiks default tracking option is the integration of a small JavaScript into the webpage, e.g. with the page footer. Of course this could easily be done by adding the code to the base Twig template.
However I would like to avoid the usage of JavaScript. My Symfony page and the Piwik page both run on the same server. Actually I am surprised that letting the client communicate with Piwik (over Javascript) is the recommended option instead of a direct way to let the webpage server talk to Piwik.
I think the Tracking HTTP API and the PHP Client are what I am looking for. However I am not sure on how to integrate this into Symfony.
I managed to connect my Symfony page with Piwik, however I wonder if this the right/best way to do it:
Used composer require "piwik/piwik-php-tracker" to add the PHPTracker to my Symfony project
Added a new Service that is responsible to create and manage a PiwikTracker object. The Service makes different methods of the Tracker, e.g. doTrackPageView() available to the rest of the project.
Added a new Twig function which uses the Service to trigger the doTrackPageView() method.
Added a call to this function to my base template
This works fine: Page views are correctly reported to Piwik and recorded without any problem. Of course I could easily add other methods to track events, actions, etc.
But: I am really surprised that I could not find any ready-to-use solution for this. Did I miss anything or is this the indented way to use Piwik with Symfony?
Google Analytics demo code at .
Logged in to Google Chrome as the owner of the Analytics Account and then navigating to that page displays my Google analytics data correctly.
I follow instructions on the page and embed the code into a simple page .
Authentication works as indicated by the displayed message: “You are logged in as: me(at)gmail.com” but there is nothing more, no graph no message.
I am reasonably certain that the page is coded correctly as I have:
Basic Dashboard (basic.html)
Multipleviews (multipleviews.html)and
Interactive Charts (ic.html)
all working and displaying correctly (they display but not styled like the demo).
Why will the page not display the graphics?
As Eike pointed out in the comments, you've simply copied and pasted the code from the demo without downloading the components to your own server. If you open up your JavaScript console, you'll notice that you have 404 errors saying the browser can't find those components. Here's a screenshot of what I see on your site:
To add those components to your site, you have a number of options. I've answered a similar question on one of the repo's Github issues, but I'll copy it here for convenience.
The built and minified versions of those components are located in the build/javascript/embed-api/components directory. You can simply download those files and add them as script tags on your page, or include them in your site's main, bundled script.
If you're using an AMD script loader like RequireJS, you can also just point to those built files as they're wrapped in a UMD wrapper.
If you're using a tool like browserify or webpack, you can npm install this repo and require the files in the src/javascript/embed-api/components directory.
I'm using Adobe Analytics as a tool within DTM. I had an issue which needed to have a particular variable be set to false s.useForcedLinkTracking=false; but the issue is I'm not sure of the proper place to set this in DTM? I tried within the tool set-up section for Adobe Analytics but the value was still true when the page compiled. The only place I got it to work properly was in the Adobe Analytics section within the "Custom Page Code" for a global page load rule.
So is there a proper place where variables like this should be set?
Thanks!
If Adobe is hosting your App Measurement file you can run your configuration variables (including calls to do_plugins) within the custom page code section of your Adobe Analytics tool. This is "global code" that will execute any time Adobe Analytics is loaded.
This approach also helps you consolidate calls to plugins and custom code in a single place without having to customize the App Measurement file itself.
Hope this helps.
You should place this in the custom s_code file (if you're not using a managed core library from Adobe) or in the custom page code within the tool config. Adding some console logging to see the full order of execution will help tremendously.
I need to insert Google Tag Manager invocation code to a website powered with Sitecore CMS 6.3 – how do I do that? It it possible without the source code, recompiling and deploying the project? Is it doable at the CMS level? Thanks.
It would depend on how your site was implemented, but this is most likely not doable at the CMS level. You are supposed to put the code for the tag container immediately after the opening body tag. Most sites are not set up to insert arbitrary code at that location.
You do not necessarily need to do a recompile. You could just add the code to your main layout aspx file. However, your organization's deployment process may (and hopefully does) require that even this minor change go through the full build and deploy process.
I work for a college and our main website has an ASP.NET based course information search which I created. This has become popular and our company facing website (training for companies) has asked for the same system on their website. I'm not involved in the day to day of either website but know theirs was made using Wordpress. Is it going to be possible for me to embed some ASP.NET code within some of the pages? Any articles on doing this?
EDIT:
The ASP.NET code that would appear in the actual Markup is minimal it's mainly a few asp:Literals I did this on purpose to hide most of it from the website developer to save myself hassle when something gets deleted by accident.
EDIT2 There was a response to do it as a webservice would this be possible. i.e. as search box on the main page displaying the results underneath.
Since asking this question a long time ago and creating a less than ideal iframe solution I have now found a great wordpress plugin called iframe-less
http://wordpress.org/extend/plugins/iframe-less-plugin/
Basically you give it an URL and it builds the content of that page directly into your wordpress page. So far it seems to work really well.
I have similar needs that the originator of this thread has. I maintain a CRM and corporate site that runs on ASP.NET/SQL along with a separate Wordpress php company blog. After we've been using Wordpress for a year, people here would love to be able to edit static content on our corporate site like we do in Wordpress, so I am looking at possible ASP.NET/Wordpress hybrid set ups.
I am hearing good things about "Phalanger": http://www.php-compiler.net
It is a PHP Language Compiler for the .NET Framework, and you can run PHP code in .NET
It was also great to find out in this thread that you can have PHP and ASP.NET in the same IIS web, its another reasonable sounding solution. If I had any nay reputation (I am new here) I'd give RickNZ a vote.
What you could do is create a web service on your ASP.NET application and then write a Wordpress plugin, that would read that service and display it in wordpress page.
This wasn't ideal but the solution I produced involved using IFrames which are still in the HTML 5 spec (infact they have some new attributes) so I think I am ok. Basically I make a page in wordpress with an IFrame and some javascript on its onload to make the iframe resize automatically based on the content size using the code below (iframe called frame with width 100 percent).
function autoIframe(){
try
{
var page_height = document.getElementById('frame').contentWindow.document.body.scrollHeight;
document.getElementById('frame').height = page_height+60;
}
catch (err)
{
window.status = err.message;
}
}
This code will resize on loading of the first content, if the content changes it will need to be called in someway. My solution was to call the method from the innerpage using parent.autoIFrame() each time a search was done.
p.s. The javascript will only work if the iframe and outer page are from the same domain (No cross site scripting).
Wordpress uses PHP and MySql. I have successfully installed and run it under Windows 2008 with IIS 7. The new CGI stuff in IIS 7 results in pretty good performance, too.
You can of course run a separate but related ASP.NET-based site on the same server.
You can also run a mixed ASP.NET + PHP site. IIS directs incoming requests to a particular HttpHandler based on the extension of the URL, so there's no reason why you can't mix *.php & *.aspx.
In fact, you can also do things like write a .NET-based HttpModule that integrates with a PHP/IIS site, to do things like logging, centralized cookie management, HTTP header "adjusting", etc.
If you want to put ASP.NET controls in a *.php file, that's a different thing entirely. To do that, you would need to write an HttpHandler that understood how to parse such a file. Either that, or just use iframes....
Short answer: no, not easily. Wordpress is PHP - you can't just put some .net code on a PHP page.
Long answer: yes, if... if you are really keen to do this, and it's worth the time and effort, you can work around it by using some of the strategies suggested already, e.g.: host the ASP.NET bit on a windows server (or use mono) and show it inside an iframe on the wordpress page.
Just bare in mind that this is not a common setup, and may be more difficult than simply creating or using some kind of Wordpress plugin.
I am exploring http://sourceforge.net/projects/wordpressnet/ if it helps anyone ...
Also,
http://wpdotnet.com/ (related article : http://www.php-compiler.net/blog/2011/wordpress-on-net-4-0)
http://wordpress.org/support/topic/installing-to-a-net-server
I know it is an old post and I too do not prefer necroposting but
these resources may improve the existing content.
WordPress is a LAMP(Linux Apache MySQL PHP) application, and normally running in Linux servers. I don't think you can integrate ASP.Net to wordpress. But off course you can provide link to ASP.Net application from WordPress.
No, this won't work. You cannot use ASP.NET on pages that are served by WordPress. You can use ASP.NET in the same web site as Wordpress, for example by having certain directories or certain pages serve ASP.NET content, while the rest of the site still serves WordPress content.
However, if the ASP.NET code you wish to use is very simple, why not do it in PHP instead? WordPress uses PHP, which is very similar to ASP.NET.
I can be able to use both Asp.Net and Wordpress on my Host (Dinamo.net.tr)
without using any plugin or iframe.
They can really work together,
you just upload your Asp.Net C# files,
and install Wordpress at the same time.