Sharing interactive posts to Google+ from your iOS app

Interactive posts provide an easy and prominent way to allow users to share your site or app with their friends and invite them to take a specific action, for example RSVP to an event or take part in a discussion. Interactive posts can drive new users to your app, improve conversions, and increase engagement.

A screenshot of the native share dialog and the resulting stream post
    alongside it.
A share dialog for an interactive post

You add interactive sharing by calling the setCallToActionButtonWithLabel method.

Before you begin

Interactive posts require that your user is signed in. You must implement sign in for your app.

Choose a call-to-action label

Choose a value from the following list to designate the label for the call-to-action button.

ACCEPT
ACCEPT_GIFT
ADD
ADD_FRIEND
ADD_ME
ADD_TO_CALENDAR
ADD_TO_CART
ADD_TO_FAVORITES
ADD_TO_QUEUE
ADD_TO_WISH_LIST
ANSWER
ANSWER_QUIZ
APPLY
ASK
ATTACK
BEAT
BID
BOOK
BOOKMARK
BROWSE
BUY
CAPTURE
CHALLENGE
CHANGE
CHAT
CHECKIN
COLLECT
COMMENT
COMPARE
COMPLAIN
CONFIRM
CONNECT
CONTRIBUTE
COOK
CREATE
DEFEND
DINE
DISCOVER
DISCUSS
DONATE
DOWNLOAD
EARN
EAT
EXPLAIN
FIND
FIND_A_TABLE
FOLLOW
GET
GIFT
GIVE
GO
HELP
IDENTIFY
INSTALL
INSTALL_APP
INTRODUCE
INVITE
JOIN
JOIN_ME
LEARN
LEARN_MORE
LISTEN
MAKE
MATCH
MESSAGE
OPEN
OPEN_APP
OWN
PAY
PIN
PIN_IT
PLAN
PLAY
PURCHASE
RATE
READ
READ_MORE
RECOMMEND
RECORD
REDEEM
REGISTER
REPLY
RESERVE
REVIEW
RSVP
SAVE
SAVE_OFFER
SEE_DEMO
SELL
SEND
SIGN_IN
SIGN_UP
START
STOP
SUBSCRIBE
TAKE_QUIZ
TAKE_TEST
TRY_IT
UPVOTE
USE
VIEW
VIEW_ITEM
VIEW_MENU
VIEW_PROFILE
VISIT
VOTE
WANT
WANT_TO_SEE
WANT_TO_SEE_IT
WATCH
WATCH_TRAILER
WISH
WRITE

Configure your share dialog

To create an interactive post, you use the share dialog builder to specify your content URL, a deep-link for the content URL, and call setCallToActionButtonWithLabel method to insert the call-to-action button. The call-to-action button gets a label, URL, and deep link identifier that you can use to prompt a reader to take immediate action in your app directly from the Google+ stream.

- (IBAction) didTapShare: (id)sender {
  // Use the native share dialog in your app:
  id<GPPNativeShareBuilder> shareBuilder = [[GPPShare sharedInstance] nativeShareDialog];

  // The share preview, which includes the title, description, and a thumbnail,
  // is generated from the page at the specified URL location.
  [shareBuilder setURLToShare:[NSURL URLWithString:@"https://www.example.com/restaurant/sf/1234567/"]];

  [shareBuilder setPrefillText:@"I made reservations!"]

  // This line passes the string "rest=1234567" to your native application
  // if somebody opens the link on a supported mobile device
  [shareBuilder setContentDeepLinkID:@"rest=1234567"];

  // This method creates a call-to-action button with the label "RSVP".
  // - URL specifies where people will go if they click the button on a platform
  // that doesn't support deep linking.
  // - deepLinkID specifies the deep-link identifier that is passed to your native
  // application on platforms that do support deep linking
  [shareBuilder setCallToActionButtonWithLabel:@"RSVP"
           URL:[NSURL URLWithString:@"https://www.example.com/reservation/4815162342/"]
    deepLinkID:@"rsvp=4815162342"];

  [shareBuilder open];
}

The protocol (http/https), host name, and port (if specified) for the content URL and the call-to-action URL must match. Because these must match, you should avoid using URL shorteners and redirects for either URL.

The deep-link identifier or URL for your call-to-action button should point to a different resource in your app than your content link, ideally to an action based on the button label. In the example above, the call-to-action button would be used to RSVP to a reservation, while the content link (and deep link identifier) would send users to details about the restaurant.

Next steps

Send feedback about...

Google+ Platform for iOS
Google+ Platform for iOS