PageSourceSearch

https://social.recurpost.com/addon/js/segment_events.js?v=15.1.076

js recurpost.com collected 2026-10-02 02:58:00 UTC 5,226 bytes, 182 lines download raw bytes

1function addLoginIdentify(dataArr) {
2
3    var dataArr = {
4        first_name: dataArr['first_name'],
5        last_name: dataArr['last_name'],
6        email: dataArr['email_id'],
7        user_id: dataArr['user_id'],
8        login_count: +1,
9        transaction_count: "",
10        current_plan: dataArr['plan_name'],
11        current_plan_billing_cycle: dataArr['billing_cycle'],
12        device_type: "web",
13    };
14
15    sendSegmentIdentifyCallWithData(dataArr['user_id'], dataArr);
16}
17
18function sendSegmentIdentifyCallWithData(user_id, dataArr) {
19
20    analytics.identify(user_id, dataArr);
21}
22
23// analytics is missing when the Segment snippet is blocked: the page must
24// keep working, so a blocked call is dropped rather than thrown.
25function segmentIsAvailable() {
26
27    return (typeof analytics !== 'undefined' && typeof analytics.track === 'function');
28}
29
30function sendSegmentTrackCallWithData(event_name, dataArr) {
31
32    if (!segmentIsAvailable()) {
33        return;
34    }
35    analytics.track(event_name, dataArr);
36}
37
38// Track, then follow a link. A navigation straight after the click drops
39// the request, so the page moves on once the call is flushed, or after a
40// short fallback so a slow network never holds the user.
41function sendSegmentTrackThenNavigate(event_name, dataArr, href) {
42
43    var navigated = false;
44    var go = function () {
45        if (navigated) {
46            return;
47        }
48        navigated = true;
49        window.location.href = href;
50    };
51
52    if (!segmentIsAvailable()) {
53        go();
54        return;
55    }
56
57    var fallback = setTimeout(go, 400);
58    analytics.track(event_name, dataArr, {}, function () {
59        clearTimeout(fallback);
60        go();
61    });
62}
63
64// Connect context the server prints into hidden inputs next to the connect
65// modals (see sa_connect_client_context() in onboarding_analytics_helper).
66function segmentConnectContext() {
67
68    return {
69        entry_point: $('#sa_entry_point').val() || '',
70        persona: $('#sa_persona').val() || '',
71        is_free_plan: ($('#sa_is_free_plan').val() === '1')
72    };
73}
74
75// A tile is blocked when it is a dead link: free plans get javascript:void(0)
76// hrefs, limit classes intercept the click, and X on free / trial opens the
77// upgrade modal. Tiles that open a platform picker are not blocked.
78function segmentConnectTileBlocked(element) {
79
80    if (!element) {
81        return false;
82    }
83
84    var tile = $(element);
85    if (tile.hasClass('socialplanlimitover') || tile.hasClass('planlimitoverduetotwitterpolicy')) {
86        return true;
87    }
88    if ((tile.attr('data-bs-target') || '') === '#upgrade-plan') {
89        return true;
90    }
91
92    var href = tile.attr('href') || '';
93    var opensPicker = (tile.attr('data-bs-toggle') || '') !== '' || tile.hasClass('facebook-group-connect-btn') || tile.hasClass('bluesky-profile-connect-btn');
94    return (href.indexOf('javascript:') === 0 && !opensPicker);
95}
96
97// The OAuth callback reads this to report seconds_since_click on the
98// resulting specific_sa_modified / sa_connect_failed event.
99function segmentRememberConnectClick() {
100
101    var clickedAt = Math.floor(Date.now() / 1000);
102    document.cookie = `rp_sa_click_at=${clickedAt}; path=/; max-age=3600; SameSite=Lax`;
103}
104
105function segmentForAddSocialAccount(event_name, title, position, modal, modal_step, page_url, user_id, email, element, stage) {
106
107    segmentRememberConnectClick();
108
109    if (!segmentIsAvailable()) {
110        return;
111    }
112
113    analytics.track(event_name, {
114        title: title,
115        position: position,
116        modal: modal,
117        modal_step: modal_step,
118        page_url: page_url,
119        user_id: user_id,
120        device_type: "web",
121    });
122
123    var context = segmentConnectContext();
124
125    analytics.track("add_specific_sa_clicked", {
126        email: email,
127        type: title,
128        sub_type: modal_step,
129        user_id: user_id,
130        device_type: "web",
131        entry_point: context.entry_point,
132        persona: context.persona,
133        is_free_plan: context.is_free_plan,
134        blocked: segmentConnectTileBlocked(element),
135        stage: stage || 'oauth_started',
136    });
137
138    var count_of_sa = 0;
139    if($("#count_of_sa").length > 0) {
140        count_of_sa = $("#count_of_sa").val();
141    }
142
143    analytics.identify(user_id, {
144        email: email,
145        user_id: user_id,
146        count_of_sa: count_of_sa,
147        device_type: "web",
148    });
149}
150
151function addSegmentSubscriptionTopbar(event_name, title, position, page_url, user_id
151) {
152    analytics.track(event_name, {
153        title: title,
154        position: position,
155        page_url: page_url,
156        user_id: user_id,
157        device_type: "web",
158    });
159}
160
161function addSegment(event_name, title, position, page_url, user_id, email) {
162
163    analytics.track(event_name, {
164        title: title,
165        position: position,
166        page_url: page_url,
167        user_id: user_id,
168        device_type: "web",
169    });
170
171    /*
172     * Add Social Account popup button Click
173     */
174    if(event_name == "button-clicked" && title == "Add Social Accounts") {
175        analytics.track("add_sa_clicked", {
176            email: email,
177            page_url: page_url,
178            user_id: user_id,
179            device_type: "web",
180        });
181    }
182}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.