---
title: Figuring out What SiteSpect is Doing on the Page
description: The following code is written in PHP and assumes that the client knows only the SSSC cookie and that the Campaign is setup with insightful Tags for Variation Groups:
---

[Skip to content](https://doc.sitespect.com/knowledge/figuring-out-what-sitespect-is-doing-on-the-page#main-content)

English

Show submenu for translations

![Monetate-Logo-Full-Color-1](https://doc.sitespect.com/hs-fs/hubfs/Monetate-Logo-Full-Color-1.png?width=340&height=49&name=Monetate-Logo-Full-Color-1.png)

- [A/B Testing](https://www.sitespect.com/testing-and-experimentation/)
- [Personalization](https://www.sitespect.com/personalization-targeting/)
- [Recommendations](https://www.sitespect.com/recommendations/)

Open main navigation

Close main navigation

- [A/B Testing](https://www.sitespect.com/testing-and-experimentation/)
- [Personalization](https://www.sitespect.com/personalization-targeting/)
- [Recommendations](https://www.sitespect.com/recommendations/)
- English
  
  Show submenu for translations

 How can we help you?

- There are no suggestions because the search field is empty.

1. [Knowledge Base](https://doc.sitespect.com/knowledge?hsLang=en)
2. [Implementation, Deployment, and Security](https://doc.sitespect.com/knowledge/implementation-deployment-and-security?hsLang=en)

# Figuring out What SiteSpect is Doing on the Page

The following code is written in PHP and assumes that the client knows only the SSSC cookie and that the Campaign is setup with insightful Tags for Variation Groups:

1. The client goes to the discovery page and retrieves the Variation Group resource through the “variationgroup” link relation and Campaign resource through “campaign” link relation.
2. The client parses the SSSC cookie, grabs the Site ID, loops through each Variation Group and Campaign combination in the cookie and fills in the URI templates of Variation Group and Campaign resources.
3. The client makes an API call to each Variation Group and Campaign resource, finds the name, and prints it on the screen with some other text and formatting.

| ``` <?php//function for making cURL requestsfunction curl($url,$method,$data){ //cURL call $ch = curl_init(); if($method){ curl_setopt ($ch, CURLOPT_POST, true); if($data){ curl_setopt ($ch, CURLOPT_POSTFIELDS, $data); } } curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, array("X-API-TOKEN: YOUR-API-TOKEN")); $output = curl_exec($ch); if($output !== false \|\| curl_error($ch)) { $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); return array($status,$output); curl_close($ch); }}//list of known variables – SSSC cookie$sssc = "6.G5861867684635283651.6\|334.3608:336.3642:367.4754";//Location of the discovery page$discovery = "http://admin1.sitespect.com/api"";//call the discovery page$request = curl($discovery);if ($request[0] == 200){ $json = json_decode($request[1],true); //get variation group and campaign URI resources from discovery page $variationgroup_uri = $json['_links']['variationgroup']["href"]; $campaign_uri = $json['_links']['campaign']["href"]; // Parse the SSSC cookie, many ways to do it, I am showing a non-regex way // Format: Site_ID.User_GUID(prefixed with a G).UserVisitCount \| TestCampaign_ID.VariationGroup_ID[:TestCampaign_ID.VariationGroup_ID:...] $split = explode("\|", $sssc); $dot = explode(".", $split[0]); $colon = explode(":", $split[1]); $Site_ID = $dot[0]; //loop through each TestCampaign_ID and VariationGroup_ID combination foreach($colon as $tcvg) { $resplit = explode(".", $tcvg); $TestCampaign_ID = $resplit[0]; $VariationGroup_ID = $resplit[1]; //Campaign URI Resource is a template, lets manually process that $campaing_call = str_replace('{site-id}', $Site_ID, $campaign_uri); $campaing_call = str_replace('{campaign-id}', $TestCampaign_ID, $campaing_call); Variation Group URI Resource is a template, lets manually process that $variationgroup_call = str_replace('{site-id}', $Site_ID, $variationgroup_uri); $variationgroup_call = str_replace('{campaign-id}', $TestCampaign_ID, $variationgroup_call); $variationgroup_call = str_replace('{variationgroup-id}', $VariationGroup_ID, $variationgroup_call); //Retrieve and Print Campaing Name $req = curl($campaing_call); if($req[0] == 200){ $json = json_decode($req[1],true); //print the name of campaign or variation group to the screen echo "Campaign: ".$json["Name"]."<br>"; } //Retrieve and print Variation Group name $req = curl($variationgroup_call); if($req[0] == 200){ $json = json_decode($req[1],true); //print the name of campaign or variation group to the screen echo "Variation Group: ".$json["Name"]."<br>"; } }}?> ``` |
| --- |

- [Get Started](https://doc.sitespect.com/knowledge/get-started?hsLang=en#main-content)

    - [SiteSpect Support](https://doc.sitespect.com/knowledge/get-started?hsLang=en#sitespect-support)
    - [Overview Information](https://doc.sitespect.com/knowledge/get-started?hsLang=en#overview-information)
    - [Intro to SiteSpect](https://doc.sitespect.com/knowledge/get-started?hsLang=en#intro-to-sitespect)
    - [Account Setup](https://doc.sitespect.com/knowledge/get-started?hsLang=en#account-setup)
    - [Artificial Intelligence](https://doc.sitespect.com/knowledge/get-started?hsLang=en#artificial-intelligence)
- [Dashboard](https://doc.sitespect.com/knowledge/dashboard?hsLang=en)
- [Build](https://doc.sitespect.com/knowledge/build?hsLang=en#main-content)

    - [Setting Up a Campaign](https://doc.sitespect.com/knowledge/build?hsLang=en#setting-up-a-campaign)
    - [Create a Client-Side Campaign](https://doc.sitespect.com/knowledge/build?hsLang=en#create-a-client-side-campaign)
    - [Create a Server-Side Campaign](https://doc.sitespect.com/knowledge/build?hsLang=en#create-a-server-side-campaign)
    - [Metrics](https://doc.sitespect.com/knowledge/build?hsLang=en#metrics)
    - [Audiences](https://doc.sitespect.com/knowledge/build?hsLang=en#audiences)
    - [Triggers](https://doc.sitespect.com/knowledge/build?hsLang=en#triggers)
    - [Variations](https://doc.sitespect.com/knowledge/build?hsLang=en#variations)
    - [Traffic Management](https://doc.sitespect.com/knowledge/build?hsLang=en#traffic-management)
    - [Preview](https://doc.sitespect.com/knowledge/build?hsLang=en#preview)
    - [Factors](https://doc.sitespect.com/knowledge/build?hsLang=en#factors)
    - [Advanced Settings](https://doc.sitespect.com/knowledge/build?hsLang=en#advanced-settings)
    - [Omnichannel](https://doc.sitespect.com/knowledge/build?hsLang=en#omnichannel)
    - [Regular Expressions (Regex)](https://doc.sitespect.com/knowledge/build?hsLang=en#regular-expressions-regex)
    - [WATTS](https://doc.sitespect.com/knowledge/build?hsLang=en#watts)
    - [Recommendations](https://doc.sitespect.com/knowledge/build?hsLang=en#recommendations)
- [Monitor](https://doc.sitespect.com/knowledge/monitor?hsLang=en)
- [Analyze](https://doc.sitespect.com/knowledge/analyze?hsLang=en#main-content)

    - [Data Export and Integration](https://doc.sitespect.com/knowledge/analyze?hsLang=en#data-export-and-integration)
    - [SiteSpect Reports](https://doc.sitespect.com/knowledge/analyze?hsLang=en#sitespect-reports)
- [Site](https://doc.sitespect.com/knowledge/site?hsLang=en#main-content)

    - [Tools](https://doc.sitespect.com/knowledge/site?hsLang=en#tools)
    - [Configuration](https://doc.sitespect.com/knowledge/site?hsLang=en#configuration)
- [Developers](https://doc.sitespect.com/knowledge/developers?hsLang=en#main-content)

    - [API Reference](https://doc.sitespect.com/knowledge/developers?hsLang=en#api-reference)
    - [Code Samples](https://doc.sitespect.com/knowledge/developers?hsLang=en#code-samples)
    - [Tips & Tricks](https://doc.sitespect.com/knowledge/developers?hsLang=en#tips-tricks)
- [Mobile](https://doc.sitespect.com/knowledge/mobile?hsLang=en)
- [Implementation, Deployment, and Security](https://doc.sitespect.com/knowledge/implementation-deployment-and-security?hsLang=en#main-content)

    - [How does SiteSpect work with CDNs?](https://doc.sitespect.com/knowledge/implementation-deployment-and-security?hsLang=en#how-does-sitespect-work-with-cdns)
    - [Single Tenant Implementations](https://doc.sitespect.com/knowledge/implementation-deployment-and-security?hsLang=en#single-tenant-implementations)
    - [Security Features](https://doc.sitespect.com/knowledge/implementation-deployment-and-security?hsLang=en#security-features)
    - [Deployment and Implementation Overview](https://doc.sitespect.com/knowledge/implementation-deployment-and-security?hsLang=en#deployment-and-implementation-overview)
    - [SiteSpect Engine & Admin API](https://doc.sitespect.com/knowledge/implementation-deployment-and-security?hsLang=en#sitespect-engine-admin-api)
- [Third-Party Integration](https://doc.sitespect.com/knowledge/third-party-integration?hsLang=en#main-content)

    - [Google](https://doc.sitespect.com/knowledge/third-party-integration?hsLang=en#google)
    - [Zuko](https://doc.sitespect.com/knowledge/third-party-integration?hsLang=en#zuko)
- [Troubleshooting](https://doc.sitespect.com/knowledge/troubleshooting?hsLang=en)
- [Releases](https://doc.sitespect.com/knowledge/releases?hsLang=en#main-content)

    - [Superfresh](https://doc.sitespect.com/knowledge/releases?hsLang=en#superfresh)
- [Feedback](https://doc.sitespect.com/knowledge/feedback?hsLang=en)

- [A/B Testing](https://www.sitespect.com/testing-and-experimentation/)
- [Personalization](https://www.sitespect.com/personalization-targeting/)
- [Recommendations](https://www.sitespect.com/recommendations/)

[![Monetate-Logo-Full-Color-1](https://doc.sitespect.com/hs-fs/hubfs/Monetate-Logo-Full-Color-1.png?width=200&height=29&name=Monetate-Logo-Full-Color-1.png "Monetate-Logo-Full-Color-1")](http://monetate.com)

<https://www.facebook.com/> <https://www.twitter.com/> <https://www.instagram.com/> <https://podcasts.apple.com/> [mailto:email@email.com](mailto:email@email.com)

Copyright © 2026, Monetate