Skip to content

Instantly share code, notes, and snippets.

View aaustin's full-sized avatar

Alex Austin aaustin

View GitHub Profile

Dear Google Ads Advertiser,

You're receiving this message to alert you to upcoming changes in your Google Ads account.

What's changing

Starting March 27, 2020, we will turn down support of App Attribution Partners and the App Conversion Tracking API for app conversion reporting and optimization in Google Ads Search, Display, Shopping, Video, and Hotel campaigns.

Starting June 28, 2019, these changes will go into effect for customers who are not already using either of these tracking methods in any of their accounts. Between July 1, 2019, and March 31, 2020, we will continue to provide best-effort support for existing customers.

@aaustin
aaustin / android-platform-routing.java
Last active December 24, 2018 22:23
How to handle deep link routing in Android apps with in-app browsers
// List of common browser package names
String[] browserPackageNames = {"com.android.chrome", "org.mozilla.firefox", "com.UCMobile.intl", "com.sec.android.app.sbrowser", "com.opera.browser", "com.opera.mini.native", "com.microsoft.emmx"};
];
void loadURL(Context context, URI destinationUrl) {
boolean isAppOpened = false;
try {
// First, check if the URI can resolve an intent
Intent intent = new Intent("android.intent.action.VIEW");
intent.setData(destinationUrl);
@aaustin
aaustin / ios-platform-routing.m
Last active December 24, 2018 19:26
How to handle deep link routing in iOS apps with in-app browsers
// I'd suggest extending this method to add a callback block to handle success/failure in your UI
- (void)loadURL:(NSURL *)destinationUrl fallbackBrowser:(WKWebView *)webview {
// First check if the destination is a URI scheme
// OR is an iTunes URL for loading an App Store page
NSError *error = NULL;
NSRegularExpression *regex =
[NSRegularExpression regularExpressionWithPattern:@"^(?!(http|https)).*:////.*|.*itunes/.apple/.com.*"
options:0
error:&error];
var fallbackToStore = function() {
window.location.replace('market://details?id=com.myapp.package');
};
var openApp = function() {
window.location.replace('your_uri_scheme://');
};
var triggerAppOpen = function() {
openApp();
setTimeout(fallbackToStore, 250);
};
<script type="text/javascript">
(function(b,r,a,n,c,h,_,s,d,k){if(!b[n]||!b[n]._q){for(;s<_.length;)c(h,_[s++]);d=r.createElement(a);d.async=1;d.src="https://cdn.branch.io/branch-latest.min.js";k=r.getElementsByTagName(a)[0];k.parentNode.insertBefore(d,k);b[n]=h}})(window,document,"script","branch",function(b,r){b[r]=function(){b._q.push([r,arguments])}},{_q:[],_v:1},"addListener applyCode banner closeBanner creditHistory credits data deepview deepviewCta first getCode init link logout redeem referrals removeListener sendSMS setBranchViewData setIdentity track validateCode".split(" "), 0);
branch.init('YOUR-BRANCH-KEY');
// You'll need to set the deep link data here, in the block where you call init().
branch.setBranchViewData({
data: {
mydata: 'something',
user_id: 'user_1234',
product_id: '12345',
<script type="text/javascript">
(function(b,r,a,n,c,h,_,s,d,k){if(!b[n]||!b[n]._q){for(;s<_.length;)c(h,_[s++]);d=r.createElement(a);d.async=1;d.src="https://cdn.branch.io/branch-latest.min.js";k=r.getElementsByTagName(a)[0];k.parentNode.insertBefore(d,k);b[n]=h}})(window,document,"script","branch",function(b,r){b[r]=function(){b._q.push([r,arguments])}},{_q:[],_v:1},"addListener applyCode banner closeBanner creditHistory credits data deepview deepviewCta first getCode init link logout redeem referrals removeListener sendSMS setBranchViewData setIdentity track validateCode".split(" "), 0);
branch.init('YOUR-BRANCH-KEY');
</script>
UIViewController *activeViewController = self; // or set the active view controller if doing this in another class
activeViewController.userActivity = [[NSUserActivity alloc] initWithActivityType:[[NSBundle mainBundle] bundleIdentifier]];
activeViewController.userActivity.delegate = self;
... // assign the parameters described in the section above
#pragma mark NSUserActivity Delegate Methods
- (void)userActivityWillSave:(NSUserActivity *)userActivity {
// self.userInfo is an instance dictionary of keys and values that you associate with the NSUserActivity
[userActivity addUserInfoEntriesFromDictionary:self.userInfo];
}
[activeViewController.userActivity becomeCurrent];
<html prefix="og: http://ogp.me/ns#">
<head>
<meta property="og:title" content="The Rock" />
<meta property="og:description" content="Directed by Michael Bay. With Sean Connery, Nicolas Cage, Ed Harris, John Spencer.
A mild-mannered chemist and an ex-con must lead the counterstrike when a rogue group of military men, led by a renegade general,
threaten a nerve gas attack from Alcatraz against San Francisco." />
<meta property="og:image" content="http://ia.media-imdb.com/images/rock.jpg" />
...
</head>
...