[ appscript ] Document

FindText in Document

// Get the body section of the active document.
var body = DocumentApp.getActiveDocument().getBody();

// Search until the paragraph is found.
var foundElement = body.findText("Pong:.*?Yesterday")
if(searchResult) {
var par = foundElement.getElement().getText();
var startPosition = foundElement.getStartOffset();
var endPosition = foundElement.getEndOffsetInclusive();

ref : https://developers.google.com/apps-script/reference/document/body

[ facebook ] pixel

<!-- Facebook Pixel Code -->
// Insert Your Facebook Pixel ID below. 
fbq('init', 'FB_PIXEL_ID');
fbq('track', 'PageView');
<!-- Insert Your Facebook Pixel ID below. -->
<noscript><img height="1" width="1" style="display:none"
<!-- End Facebook Pixel Code -->

NOTE : change the FB_PIXEL_ID to yours.

To add the standard events and custom events, please refer to the reference below.

ref : https://developers.facebook.com/docs/facebook-pixel/api-reference#

[ facebook ] analytics

  • 77 % customers are lost in the first week
  • 60 % apps are used less than 10 times
  • 77 % People with 3 or more devices start a task on one device and complete on a different device
  • 180 % higher retention when people opt-in to push notification — aka. campaign/weekly deal/daily deal (within 3 months)

Event Javascript API
– No need facebook login/all people will be tracked action but facebook login will have more deep data aggregation.

* Activate


#### TODO : Pixel example ?

* View Content up to 25 differents Parameters/1000 event types i.e. Content Type, Content ID ( or product id ), Description, Currency, Value, Category
Tips :
– log the 1st most important action to optimize i.e. Purchase
– also log lead-in events that contribute to that goal i.e. add to cart
– free and no limit on number of events logged

* User : Who i.e. user id, install source i.e. twitter, registeration year, loyalty program
– sent CRM data via API
– sent via SDK

* TODO : Share ?
Sharing insight facebook feature

* Search up to 25 differents parameters i.e. Flight

var params = {};
params[FB.AppEvents.ParameterNames.SearchType] = 'Flight';

NOTE : In addition to the predefined events, you can also create custom events by specifying their name as a string.
The maximum length for a custom event name is 40 characters and it can only use characters that are letters, numbers, underscores, or dashes.
You can have a maximum of 1,000 different event names. Note: No new event types will be logged if you reach this maximum level. If you exceed this limit, you’ll see an 100 Invalid parameter error when trying to log new event types. However, you can deactivate any existing events that you may not be using. Learn more about event limits.

* Registered

* Add to cart

* Archieved Level

* Message Sent

* Purchase

FB.AppEvents.logPurchase(578, "USD");

ref : https://analytics.facebook.com/support,

Customer case study : https://analytics.facebook.com/customers
Stack Overflow : #Facebook-Analytics
twitter : @fbanalytics

[ rails ] link_to_if


link_to_if(condition is true, name, options = {}, html_options = {}, &block)

NOTE : if condition is true, otherwise only the name is returned

link_to_if(it_has_link?, "text to show", "http://google.com", target: '_blank', rel: "http://whatever/rel/url")

ref : http://api.rubyonrails.org/v5.1/classes/ActionView/Helpers/UrlHelper.html