Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I want to write a program to change the content when browsing a web page, and suppose to add the following feature:
1) to highlight some keywords
2) change the background of the keywords
3) when mouse move on it, will give a message bubble
I have some ideas, but I am not sure which one will work:
write an addon for firefox
write an extension for chrome
write a proxy using php to change the content of the web page being proxy-ed.
inject javascript to the web page
other solutions ... ?
which one can solve the problem ? and which one is the best?
Thanks in advance.
Try using a bookmarklet. They are simply javascript snippets masquerading as bookmarks in a user's bookmark bar. When a user clicks on the bookmark, the javascript code is injected and run on the current website. You wouldn't need to have your users download additional software or be tied down to a particular browser.
Here is an excellent link to get you started
http://net.tutsplus.com/tutorials/javascript-ajax/create-bookmarklets-the-right-way/
It is 1+4 or 2+4 (or 1+2+4), you'll have to write a script that will be injected to the pages and it can be used as a Firefox Greasemonkey script or a Chorme extension.
Unlike in Firefox where you need Greasemonkey to make scripts work, a simple script file can be used directly as a Chrome extension by dragging it to the extensions window. With some more official documentation on how to organise an extension you can make it a complete Chrome extension.
A sample script that will inject script only when you are on stackoverflow:
script.user.js
if(document.URL.indexOf("http://stackoverflow.com")!=-1) {
var d = document.createElement("div");
d.innerHTML = "Hello World! This is my first injected script";
d.className = "red"; // supposing it's defined, wouldn't hurt anyways
// otherwise
d.style.color = "#f00";
document.body.appendChild(d);
}
Save your file and drag it to the "extentions" window on Chrome, then reload stackoverflow.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have two sites with different server. I need to get post of one site to another wordpress site. I have database and cpanel of both server. I guess i can do using rss feed or fetching the database directly. I need to get all the post content including images and all. so i think rss feed will not be the better solution.
Please suggest me the better solution. Thank you
use WP API
e.g.
$posts = json_decode(file_get_contents('http://example.com/wp-json/wp/v2/posts?filter[posts_per_page]=20&filter[orderby]=date'));
foreach ( $posts as $post ) {
echo ''.$post->title->rendered.'';
}
It depends on the approach you want to use as this question is primarily opinion-based.
Although,
One and good approach is to have a single database for both the server. As mentioned in your question, images and other media will get shared too.
So On the second server you can connect to the main database of the first server and then whenever you show the media like images, show it from the first server (By using URL of first server). For this you might need to update the codes of the second server.
The better approach is master and slave concept.
Make a plugin for your WordPress site and listen to new posts by filters. whenever a new post comes in , write it to another WordPress site's database.
Reference:
wp_insert_post() https://developer.wordpress.org/reference/functions/wp_insert_post/
You should perform this using wordpress inbuilt functionality that is import and export through wordpress admin.
Just go to your wordpress admin from where you want to shift all post.Then go to tools section and click on export and select posts in your case. You can also export all content, pages etc. using this. You will get a .xml file, just download it.
Check here : https://codex.wordpress.org/Tools_Export_Screen
Now, go to wordpress admin of your another website where you want to import content. Just go to tools and click on import and go with the flow.
Wordpress have a builtin export function. Export that from the other site and import on the other site.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have a webpage I'm trying to promote via ad banners. I want to associate a utm code to those those links, so when a visitor lands on my website, I'll be able to track where they came from (mysite.com?utm_campaign=adXYZ)
Normally these ad banners lead to a single webpage with single point of conversion where I'm able to capture the utm_campaign ID and gauge how effective my marketing is. However, I'm now leading users to a full website with many pages and many points of conversion. I'm hoping to keep that utm_campaign ID across multiple pages using some crafty JS or PHP.
For example:
user clicks ad banner to mysite.com?utm_campaign=adXYZ
user lands on mysite.com but wants to go to mysite.com/features
user goes from mysite.com/features to mysite.com/pricing
By the time the user reaches mysite.com/pricing, I want ?utm_campaign=adXYZ to still be there in the URL.
I know there are ways via analytics and what not to track a session/conversion, but I specifically need to capture the referral utm code in an HTML form down the road. Can anyone point me in the right direction? Thanks a bunch!
Edit: An important point to note. The site should still be accessible organically via search, bookmark, linking, etc and not have the trailing campaign ID in the URL. Only when user visits the site from ad banner should the campaign be there and all subsequent pages.
I would set a cookie containing the relevenat information the first time the user enters your website.
Otherwise you have to pass the information every time again with every request (GET / POST). This solution will work even if the user don't allow cookies. Murat Cem YALIN wrote how this works in detail. But if you want to use the JS-method: Be aware that the user must have JS activated!
The third option might be using PHP Sessions.
you can do it with both php and js.
in php use simplehtmldom (http://simplehtmldom.sourceforge.net/) to access all links in html output and add ?utm_campaign=adXYZ to all of them just before outputting rendered html.
in js you use jquery to do the same when the document loaded. ex:
$("a").each(function(){
$(this).attr("href", $(this).attr("href") + '?utm_source=adxYZ');
});
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I looked all over google and the internet as to performing In Page A/B testing.
What I am trying to do is perform A/B testing on a single page, but that page's content varies on the referring url, performed through <?php include
Say if you come from Google, it displays, 'Hey, are you new here?!', or if you come from another page on our website it will display 'Let's get you started'. The goal is then to see which page has longer visit duration.
Does anyone know of how to do this through Google analytics/Optimizely or any other analytics plugin?
Ryan,
I believe this shouldn't be too difficult to do... just depends on the tools you use :-).
Personally, I can recommend Visual Website Optimizer, which allows you to segment a running test to specific segment based on various conditions. Referring URL is one of them (see screen below).
However, you can then use only one variation of the page, so if you have more segments that you would like to test, you would need to:
Duplicate the test itself,
Change the copy in the variation,
Set up the segment rules according to your needs,
Follow this procedure with every segment :)
I have done this, but can't say it had much impact. It was too much work and I personally prefer segmenting based on customer data (new/existing customer etc.), where you can notice much more impact and it's also then "easier" to report since the differences are quite noticeable.
Hope this helps!
You should be able to set this up in any modern A/B testing tool on the market. Here’s how to do it in Optimizely:
Create a new experiment and go to Options and Targeting. Select the page that the experiment should run on and select the referrers it should run for in Visitor Conditions:
Make sure that the messaging isn’t displayed for the the Original / Control / A in the experiment.
For the Variation / A, use the visual editor to add an element with the messaging or select an existing element on the page to change it’s text. You can also write Javascript code to insert the element (via ‘Edit Code’).
If you want to display different messages for different referrers, click on the the ‘Edit Code’ ribbon in Optimizely and wrap the Javascript in if clauses for each referrer (and create a backup message), like so:
if (document.referrer.match(/^https?:\/\/([^\/]+\.)?reddit\.com(\/|$)/i)) {
$('#welcome-message').text('Hi redditor!');
} if (document.referrer.match(/^https?:\/\/([^\/]+\.)?huffingtonpost\.com(\/|$)/i)) {
$('#welcome-message').text('Hi Huffington Post reader!');
} else {
$('#welcome-message').text('Hi! I’m a backup message, just in case !');
}
Select Options and Analytics Integration. Enable Google Analytics.
Start the experiment. Within a few minutes you should see the first results in Optimizely. In a few hours, results will be available in Google Analytics, where you can drill down to see how things like visit duriation, pageview per visit and bounce rate changed based on custom segments (that’s how the variations are displayed in Google Analytics).
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I like to pause music when switching to another page from home page & on returning back we should resume the music as it was before. It shouldn't need to restart the music again when I get back to home page.
We are using flashplayer found from this site:
http://flashnifties.com/products/nifty-audio-player/documentation/
However we have not found any script which fulfill our need.
Please help me if anyone has the solution of this problem.
The critical part of this problem is that you are reloading the page, which completely resets the Flash player within it. You are left with two options:
Implement your site as a single page application and use ajax to refresh the content. This means that the Flash player will not be reloaded when the user needs more content (this is what we do on our site).
-or-
Use a frameset, with player loaded in one frame, and rest of website in the other. This is a bad choice of architecture... frames are evil.
It looks like you can pause with this:
audioPlayer.pauseAudio()
I would add this javascript to the button or object that changes to a new url (page). This listens for an action and does
document.getElementById('newPageButton').onclick = function() {
//interact with the flash "audioPlayer.pauseAudio();", cache song time location.
//go to next page code
}
you'll probably need to write your own actionscript to save the location of were the song was paused at. Looking at the documentation there isn't a way to see exactly were the song was paused.
After you figure that out, store the location on some sort of caching. Load that caching when you go back to the page. Though looking at the documentation again, it looks like you'll need to write some actionscript to get resuming at a specific time working.
This might not be the best flash player for what you wish to achieve.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I know this is a BIG question, but i am looking to integrate magento with mobi-cart and I wondered where the best place to start with something like this would be?
I need to export certain fields into and xml feed that updates mobi-cart. Their API is here: http://www.mobi-cart.com/docs/api/index.html
I would like some pointers - is it just PHP and XML or will i need other tech? Would i have to make a module for magento that can export XML?
Any help would be appreciated.
##willywonka --Nice post- i used this link
http://www.YOURSHOP.com/api/?wsdl
If you get an XML response then soap is installed on the server and magento is ready to conenct.. if you get somthing like "..unable to laod soap..." you will have to install soem things.
to export you will need to use profiles. It runs a profile and creates a file on the server. i am not sure if you can a feed. but it migh tbe possible using the download option.
[Open Image in new tab for good resolution]
Then when you press "Run Profile" a windows will popup and you can use the Link to creat the feed
Like mine is ..
http://www.MYSHOP.co.uk/index.php/admin/system_convert_gui/run/id/7/
Afterwards i download the file using a .net program and process the data. once i am done i upload to ftp for example and run another profile to import the stuff.
In you case your program will use the file to get data in send it into the API somehow.
That was the easy way- but not very great.
The magento API is explained here
http://www.magentocommerce.com/support/magento_core_api
and looks like a nightmare to get to work and it seems like you can only do it if you have ssh access to the server to install things to it. But that would be the ideal way for these to API's to communicate.