PageSourceSearch

https://www.robinsonpetshop.it/app/mu-plugins/robinson-marketing-t…/js/robinson-marketing-tracker.js?ver=1.0.0

js robinsonpetshop.it collected 2026-09-26 19:19:54 UTC 3,480 bytes, 107 lines download raw bytes

1/**
2 * Robinson Marketing Tracker - Frontend Support
3 * JavaScript helper for updating marketing parameters
4 * 
5 * @package RobinsonMarketingTracker
6 * @version 1.0.0
7 */
8
9(function($) {
10    'use strict';
11    
12    // Marketing Tracker object
13    window.RobinsonMarketingTracker = {
14        
15        /**
16         * Update marketing parameters via AJAX
17         */
18        updateParams: function(params, callback) {
19            var data = {
20                action: 'update_marketing_params',
21                nonce: robinson_marketing.nonce
22            };
23            
24            // Add parameters to data
25            for (var key in params) {
26                if (params.hasOwnProperty(key)) {
27                    data[key] = params[key];
28                }
29            }
30            
31            $.ajax({
32                url: robinson_marketing.ajax_url,
33                type: 'POST',
34                data: data,
35                success: function(response) {
36                    if (callback && typeof callback === 'function') {
37                        callback(response);
38                    }
39                },
40                error: function(xhr, status, error) {
41                    console.error('Marketing tracker error:', error);
42                    if (callback && typeof callback === 'function') {
43                        callback({success: false, error: error});
44                    }
45                }
46            });
47        },
48        
49        /**
50         * Extract UTM parameters from current URL
51         */
52        extractUTMFromURL: function(url) {
53            url = url || window.location.href;
54            var params = {};
55            var urlParams = new URLSearchParams(url.split('?')[1] || '');
56            
57            var trackingParams = [
58                'utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',
59                'gclid', 'gclsrc', 'gbraid', 'wbraid',
60                'fbclid', 'fbadid', 'fbcampaignid',
61                'ttclid', 'tt_medium', 'tt_campaign',
62                'igshid', 'ref', 'source', 'campaign'
63            ];
64            
65            trackingParams.forEach(function(param) {
66                if (urlParams.has(param)) {
67                    params[param] = urlParams.get(param);
68                }
69            });
70            
71            return params;
72        },
73        
74        /**
75         * Track parameters from current page
76         */
77        trackCurrentPage: function(callback) {
78            var params = this.extractUTMFromURL();
79            if (Object.keys(params).length > 0) {
80                this.updateParams(params, callback);
81            }
82        },
83        
84        /**
85         * Track custom event with parameters
86         */
87        trackEvent: function(eventData, callback) {
88            // Add event tracking if needed
89            //console.log('Marketing event tracked:', eventData);
90            if (callback && typeof callback === 'function') {
91                callback({success: true});
92            }
93        }
94    };
95    
96    // Auto-track on page load if parameters are present
97    $(document).ready(function() {
98        if (typeof robinson_marketing !== 'undefined' && robinson_marketing.auto_track) {
99            RobinsonMarketingTracker.trackCurrentPage(function(response) {
100                if (response && response.success) {
101                    //console.log('Marketing parameters automatically tracked');
102                }
103            });
104        }
105    });
106    
107})(jQuery);

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.