Pay with a Plus

Redirect to new content

Using this example, we can redirect to a new page once the user clicks the +1 button.


+1 this page to redirect to your download!

The code

Inside the <head> tag on your page, place the following (ideally just before the closing </head> tag). Download the required files on GitHub.

					<script type="text/javascript" src="PATHTO/paywithaplus.min.js"></script>
					<script type="text/javascript">

						function paywithaplus(data) {
							var x = new $.payWithAPlusPlugin({
								redirectTo: '/paywithaplus/downloadlink',
								redirectSpeed: 2000,
								// Push this as an event GA?
								pushToAnalytics: true,
								customPushEvent: 'PayWithAPlus', 
								// Do not edit below this line...
								buttonPush: data.state,
								buttonHREF: data.href

A quick explanation

This will probably make better sense if you've read the blog post (especially regarding the 2 second redirect), but here's a quick explanation. Firstly we're including the script. Note the PATHTO (ie, where you've put it). Also note you should have already included jQuery. There are 4 settings here that we can customise. As above, each one needs a comma after it. The only things you need to include are listed in bold.

Back to the index...
Back to the blog post...